Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I integrate an existing Qt project in another Qt project



  • Hello,

    I would like to integrate an existing Qt project in another Qt project. I thought about a solution via libs (libaries).
    The existing Qt project is the QtFirebase Example. When it exists a simple method, for example with libs or other, I'm grateful for comments. Otherwise I know that you can subdivide via subdir, but I would need a step by step statement.


  • Lifetime Qt Champion



  • Well, I followed the instructions, but it did not really help me. To clarify again, my point is to include push notifications in an existing Qt project. I've done the QtFirebase example and I can get push notifications. Now I would like to integrate this functionality into another project. As mentioned earlier, it would be best if I clicked "Add to Library" within another project and the push notification feature is added.

    Surely there must be a possibility, I am convinced of that. Request for feedback.


  • Lifetime Qt Champion

    @Robin-Hood said in How can I integrate an existing Qt project in another Qt project:

    I've done the QtFirebase example and I can get push notifications.

    Then do it like in that example.
    What exactly is the problem?



  • Well in the QtFirebase Example project this functionality is included from the beginning. So the whole C ++ files (for qtfirebasemessaging) as well as the platform files (for Android and iOS) are embedded within the whole folder structure. If I want to include these push notifications in a new project, then I do not want to add the individual files and customize my folders and thus all my previous project. I would like to include this feature (push notifications) as a small part in my previous project. It would be best to add this functionality via "Add library". Do you know, what is my problem now?


  • Lifetime Qt Champion

    @Robin-Hood said in How can I integrate an existing Qt project in another Qt project:

    Do you know, what is my problem now?

    No, I don't.
    I already posted links explaining how to create libraries and how to use them.
    You answered that it didn't help you, but you did not tell what exactly is the problem with creating a shared library.



  • Soooo ...

    I have some old project (DataSaveModel). In it, I want to include the feature (push notifications), so this app should get push notifications from FCM (Firebase Cloud Messsaging). DataSaveModel is in the subdirsProject (test). I have worked through the tutorial Creating Shared Libraries and Adding Libraries to Projects and unfortunately did not reach my goal. For me it is not easy, what exactly is the problem or why it does not work (compiler shows no error). For this reason I have attached several screenshots to the comment. Please look at the pictures.

    I hope you or anyone else can tell me what's wrong.

    0_1542708752399_Screenshot (48).png

    0_1542708760445_Screenshot (49).png

    0_1542708765784_Screenshot (50).png

    0_1542708771205_Screenshot (51).png



  • On the last picture you can see that I had tested through the console output, if he goes through the command. I do not get console output unfortunately. For this reason, I think that I do not even go into the header file. The acquaintance has already been made. I've also added the library to the project, how to recognize the images, and the folder structure of the project.


  • Lifetime Qt Champion

    Hi,

    Where do you put your shared library ?
    Where do you put your application executable ?



  • @SGaist said in How can I integrate an existing Qt project in another Qt project:

    Where do you put your shared library ?

    I have created the new static shared libary "mysharedlib" in the subdir "Test". Then I have added the libary to subdir "Test". I thought so with "add libary" I would have put my shared libary (look at third picture).

    My application executable is in the folder "DataSaveModell" (look at third picture).

    SUBDIRS += \
    DataSaveModel \
    mysharedlib
    


  • Or did you mean with "your application exectuable" the .pro-file of the feature "push notifications". This content is in the file "mysharedlib.pro".

    0_1542790479786_Screenshot (52).png

    0_1542790488116_Screenshot (53).png


  • Lifetime Qt Champion

    A static shared library ?

    You must also ensure that you build your sub projects in the correct order.



  • @SGaist said in How can I integrate an existing Qt project in another Qt project:

    A static shared library ?

    c ++ library - statically linked library

    Where is my correct ordner??
    I have send you very many pictures of my project. Can you tell me something useful and no fragments which I can not do anything or think about what you mean by that, please?


  • Lifetime Qt Champion

    @Robin-Hood said in How can I integrate an existing Qt project in another Qt project:

    @SGaist said in How can I integrate an existing Qt project in another Qt project:

    Where is my correct ordner??

    Usually the library has to be build before the program

    I have send you very many pictures of my project. Can you tell me something useful and no fragments which I can not do anything or think about what you mean by that, please?

    Other way round. You gave us lots of fragments. Can't you upload the whole project somewhere?

    Regards



  • ok yes, I upload my whole project here.


  • Lifetime Qt Champion

    @Robin-Hood where?



  • I will now upload a different project than it was in the previous pictures. However, this is based on the same problem and is built exactly the same way. My problem is that my executable file (the project, which I want to include the library. It is located in the folder "QtAndroidJava2Cpp ") does not know the contents of my added library (here: "mylib ") and therefore does not execute. Once you have downloaded the zip file, you will see that I want to output several strings on the console (in Qt-Creator), which are located in "App/mylib/mylib.cpp " and "App/mylib/mylib.h ."
    Here you can upload this project under:
    zippyshare


  • Lifetime Qt Champion

    @Robin-Hood

    Some words in advance, before I even try to compile the project.

    TEMPLATE = subdirs
    SUBDIRS +=
    QtAndroidJava2Cpp
    mylib
    CONFIG += ordered

    Never use CONFIG+=ORDERED. (And if, you would have to specify the lib first, because the app links against the lib). The correct way is to specify dependencies:

    QtAndroidJava2Cpp.depends = mylib

    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/mylib/ -lmylib
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/mylib/ -lmylibd
    else:unix: LIBS += -L$$OUT_PWD/mylib/ -lmylib

    INCLUDEPATH += $$PWD/mylib
    DEPENDPATH += $$PWD/mylib

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/mylib/libmylib.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/mylib/libmylibd.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/mylib/mylib.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/mylib/mylibd.lib
    else:unix: PRE_TARGETDEPS += $$OUT_PWD/mylib/libmylib.a

    All this does not make sense in the pro-file that contains TEMPLATE=SUBDIRS. If you need global configurations, put them in a global.pri and include them in the pro files that needs them.

    So far.

    Edit:

    One more hint: Don't include the .pro.user files when you upload projects. They cannot be shared and just bloat the archive.

    That said, I tried to compile your project but it doesn't work as I don't have androidextras (and not even an android compiler).

    But I also wonder, why you copied mysharedlib_global.h into the QtAndroidJava2Cpp project? It should be in the shared library project.

    Regards


  • Lifetime Qt Champion

    @Robin-Hood:

    Please find a small subdirs example here: https://www64.zippyshare.com/v/XQKzMN1b/file.html

    It does what you request, and you should get the point.

    Regards



  • Thank you first. I am still very inexperienced in terms of programming with Qt. :/
    I have now downloaded the project from you "SubdirsExample". Unfortunately, I can not do it correctly. I get the error messages:

    c:/users/robin/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lLib
    ..\..\SubdirsExample\App/mainwindow.cpp:13: error: undefined reference to 'Lib::greet()'
    collect2.exe: error: ld returned 1 exit status
    make[1]: *** [libApp.so] Error 1
    make: *** [sub-App-make_first] Error 2
    make[1]: Leaving directory `C:/Users/Robin/Documents/build-SubdirsExample-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/App'
    09:44:22: Der Prozess "C:\Users\Robin\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" wurde mit dem Rückgabewert 2 beendet.
    Fehler beim Erstellen/Deployment des Projekts SubdirsExample (Kit: Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7))
    Bei der Ausführung von Schritt "Make"
    

    0_1542876644668_Screenshot (54).png

    I have testet with different devices (with a Android device and with Desktop Qt 5.11.1 32 Bit). Additional I have tried the programm under Windwos and Linux, but the same error message.

    I think that the error is in the blue marked line. The compiler tried to read the Lib.lib File, but in order "Lib" I have only:
    lib.cpp
    lib.h
    Lib.pro
    lib_global.h

    I don´t have a .lib-File.

    0_1542876990774_Screenshot (55).png

    This is your program. Do you have the same error or do you know, where is the problem in detail?


  • Lifetime Qt Champion

    @Robin-Hood

    It seems you already modified my project. It worked perfectly fine for me on Ubuntu, and it should work on Windows too.

    Please provide a complete compile log (as text!), preferable from a native compiler. I especially need to see the linker command call.



  • All the changes I made are commented on.

    Here is my complete compile log:

    14:55:20: Führe Schritte für Projekt SubdirsExample aus...
    14:55:20: Unveränderte Konfiguration, qmake-Schritt wird übersprungen.
    14:55:20: Starte "C:\Users\Robin\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" 
    cd App\ && ( if not exist Makefile C:\Qt\Qt5.11.1\5.11.1\android_armv7\bin\qmake.exe -o Makefile C:\Users\Robin\Documents\SubdirsExample\App\App.pro -spec android-g++ "CONFIG+=debug" "CONFIG+=qml_debug" ) && C:/Users/Robin/android-ndk-r17b/prebuilt/windows-x86_64/bin/make -f Makefile 
    make[1]: Entering directory `C:/Users/Robin/Documents/build-SubdirsExample-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/App'
    C:\Qt\Qt5.11.1\5.11.1\android_armv7\bin\uic.exe ..\..\SubdirsExample\App\mainwindow.ui -o ui_mainwindow.h
    C:\Users\Robin\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\Robin\android-ndk-r17b/sysroot -isystem C:\Users\Robin\android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtCore -I. -I. -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\mkspecs\android-g++ -o main.obj ..\..\SubdirsExample\App\main.cpp
    C:\Users\Robin\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\Robin\android-ndk-r17b/sysroot -isystem C:\Users\Robin\android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtCore -I. -I. -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\mkspecs\android-g++ -o mainwindow.obj ..\..\SubdirsExample\App\mainwindow.cpp
    C:\Users\Robin\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -D__ANDROID_API__=16 --sysroot=C:\Users\Robin\android-ndk-r17b/sysroot -isystem C:\Users\Robin\android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -dM -E -o moc_predefs.h C:\Qt\Qt5.11.1\5.11.1\android_armv7\mkspecs\features\data\dummy.cpp
    C:\Qt\Qt5.11.1\5.11.1\android_armv7\bin\moc.exe -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include ./moc_predefs.h -IC:/Qt/Qt5.11.1/5.11.1/android_armv7/mkspecs/android-g++ -IC:/Users/Robin/Documents/SubdirsExample/App -IC:/Users/Robin/Documents/SubdirsExample/Lib -IC:/Qt/Qt5.11.1/5.11.1/android_armv7/include -IC:/Qt/Qt5.11.1/5.11.1/android_armv7/include/QtWidgets -IC:/Qt/Qt5.11.1/5.11.1/android_armv7/include/QtGui -IC:/Qt/Qt5.11.1/5.11.1/android_armv7/include/QtCore -I. -IC:/Users/Robin/android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -IC:/Users/Robin/android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/include -IC:/Users/Robin/android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -Ic:/users/robin/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include -Ic:/users/robin/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/include-fixed -IC:/Users/Robin/android-ndk-r17b/sysroot/usr/include ..\..\SubdirsExample\App\mainwindow.h -o moc_mainwindow.cpp
    C:\Users\Robin\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=16 --sysroot=C:\Users\Robin\android-ndk-r17b/sysroot -isystem C:\Users\Robin\android-ndk-r17b/sysroot/usr/include/arm-linux-androideabi -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\include\QtCore -I. -I. -IC:\Qt\Qt5.11.1\5.11.1\android_armv7\mkspecs\android-g++ -o moc_mainwindow.obj moc_mainwindow.cpp
    C:\Users\Robin\android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\Users\Robin\android-ndk-r17b/platforms/android-16/arch-arm/ -Wl,-soname,libApp.so -Wl,-rpath=C:/Qt/Qt5.11.1/5.11.1/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libApp.so main.obj mainwindow.obj moc_mainwindow.obj   -LC:\Users\Robin\android-ndk-r17b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/users/robin/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -L../Lib -lLib -LC:/Qt/Qt5.11.1/5.11.1/android_armv7/lib -lQt5Widgets -Lc:\utils\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -Lc:/utils/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.9 -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc
    c:/users/robin/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lLib
    ..\..\SubdirsExample\App/mainwindow.cpp:13: error: undefined reference to 'Lib::greet()'
    collect2.exe: error: ld returned 1 exit status
    make[1]: *** [libApp.so] Error 1
    make: *** [sub-App-make_first] Error 2
    make[1]: Leaving directory `C:/Users/Robin/Documents/build-SubdirsExample-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Debug/App'
    14:55:34: Der Prozess "C:\Users\Robin\android-ndk-r17b\prebuilt\windows-x86_64\bin\make.exe" wurde mit dem Rückgabewert 2 beendet.
    Fehler beim Erstellen/Deployment des Projekts SubdirsExample (Kit: Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7))
    Bei der Ausführung von Schritt "Make"
    14:55:34: Verstrichene Zeit: 00:14.
    


  • this is the compiler log with "Desktop Qt 5.11.1 MinGW 32bit"

    15:19:30: Führe Schritte für Projekt SubdirsExample aus...
    15:19:30: Unveränderte Konfiguration, qmake-Schritt wird übersprungen.
    15:19:30: Starte "C:\Qt\Qt5.11.1\Tools\mingw530_32\bin\mingw32-make.exe" 
    cd App\ && ( if not exist Makefile C:\Qt\Qt5.11.1\5.11.1\mingw53_32\bin\qmake.exe -o Makefile C:\Users\Robin\Documents\SubdirsExample\App\App.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug" ) && C:/Qt/Qt5.11.1/Tools/mingw530_32/bin/mingw32-make -f Makefile 
    mingw32-make[1]: Entering directory 'C:/Users/Robin/Documents/build-SubdirsExample-Desktop_Qt_5_11_1_MinGW_32bit-Debug/App'
    C:/Qt/Qt5.11.1/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[2]: Entering directory 'C:/Users/Robin/Documents/build-SubdirsExample-Desktop_Qt_5_11_1_MinGW_32bit-Debug/App'
    C:\Qt\Qt5.11.1\5.11.1\mingw53_32\bin\uic.exe ..\..\SubdirsExample\App\mainwindow.ui -o ui_mainwindow.h
    g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtANGLE -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtCore -Idebug -I. -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\mkspecs\win32-g++  -o debug\main.o ..\..\SubdirsExample\App\main.cpp
    g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtANGLE -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtCore -Idebug -I. -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\mkspecs\win32-g++  -o debug\mainwindow.o ..\..\SubdirsExample\App\mainwindow.cpp
    g++ -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -dM -E -o debug\moc_predefs.h C:\Qt\Qt5.11.1\5.11.1\mingw53_32\mkspecs\features\data\dummy.cpp
    C:\Qt\Qt5.11.1\5.11.1\mingw53_32\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include debug/moc_predefs.h -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/mkspecs/win32-g++ -IC:/Users/Robin/Documents/SubdirsExample/App -IC:/Users/Robin/Documents/SubdirsExample/Lib -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/include -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/include/QtWidgets -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/include/QtGui -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/include/QtANGLE -IC:/Qt/Qt5.11.1/5.11.1/mingw53_32/include/QtCore -I. -IC:/Qt/Qt5.11.1/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include -IC:/Qt/Qt5.11.1/Tools/mingw530_32/lib/gcc/i686-w64-mingw32/5.3.0/include-fixed -IC:/Qt/Qt5.11.1/Tools/mingw530_32/i686-w64-mingw32/include -IC:/Qt/Qt5.11.1/Tools/mingw530_32/i686-w64-mingw32/include/c++ -IC:/Qt/Qt5.11.1/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32 -IC:/Qt/Qt5.11.1/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward ..\..\SubdirsExample\App\mainwindow.h -o debug\moc_mainwindow.cpp
    g++ -c -fno-keep-inline-dllexport -g -std=gnu++11 -Wall -W -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\..\SubdirsExample\App -I. -I..\..\SubdirsExample\Lib -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtWidgets -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtGui -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtANGLE -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\include\QtCore -Idebug -I. -IC:\Qt\Qt5.11.1\5.11.1\mingw53_32\mkspecs\win32-g++  -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp
    g++ -Wl,-subsystem,windows -mthreads -o debug\App.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o  -lmingw32 -LC:\Qt\Qt5.11.1\5.11.1\mingw53_32\lib C:\Qt\Qt5.11.1\5.11.1\mingw53_32\lib\libqtmaind.a -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-win32\lib -LC:\Utils\postgresql\pgsql\lib -lshell32 -L..\Lib -lLib C:\Qt\Qt5.11.1\5.11.1\mingw53_32\lib\libQt5Widgetsd.a C:\Qt\Qt5.11.1\5.11.1\mingw53_32\lib\libQt5Guid.a C:\Qt\Qt5.11.1\5.11.1\mingw53_32\lib\libQt5Cored.a 
    C:/Qt/Qt5.11.1/Tools/mingw530_32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lLib
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:67: recipe for target 'debug\App.exe' failed
    mingw32-make[2]: Leaving directory 'C:/Users/Robin/Documents/build-SubdirsExample-Desktop_Qt_5_11_1_MinGW_32bit-Debug/App'
    mingw32-make[2]: *** [debug\App.exe] Error 1
    Makefile:36: recipe for target 'debug' failed
    mingw32-make[1]: Leaving directory 'C:/Users/Robin/Documents/build-SubdirsExample-Desktop_Qt_5_11_1_MinGW_32bit-Debug/App'
    mingw32-make[1]: *** [debug] Error 2
    Makefile:41: recipe for target 'sub-App-make_first' failed
    mingw32-make: *** [sub-App-make_first] Error 2
    15:19:49: Der Prozess "C:\Qt\Qt5.11.1\Tools\mingw530_32\bin\mingw32-make.exe" wurde mit dem Rückgabewert 2 beendet.
    Fehler beim Erstellen/Deployment des Projekts SubdirsExample (Kit: Desktop Qt 5.11.1 MinGW 32bit)
    Bei der Ausführung von Schritt "Make"
    15:19:49: Verstrichene Zeit: 00:19.
    

  • Lifetime Qt Champion

    @Robin-Hood

    A big sorry! For some reasons, the following line is missing in SubdirsExample.pro:

    App.depends = Lib

    Just put it at the end, and re-run qmake, afterwards rebuild all. Should work! :)



  • @aha_1980 said in How can I integrate an existing Qt project in another Qt project:

    App.depends = Lib

    Thank you so much. On my Android deveice is working. :)


  • Lifetime Qt Champion

    @Robin-Hood So please mark this thread as SOLVED now. Thanks!


Log in to reply