QtCreator fails to run an application that depends on a library in the same project
-
Hi,
I am using QtCreator 4.1.0 from revision 8c80a86266 on Windows with Visual Studio 2015
My project is as follows:
TestProject.qbs
Project { references: [ "TestApp/TestApp.qbs", "TestLib/TestLib.qbs" ] }
TestApp.qbs
CppApplication { Depends { name: "TestLib" } files: [ "main.cpp", ] }
main.cpp
__declspec(dllimport) int test_returner (); int main () { return test_returner (); }
TestLib.qbs
DynamicLibrary { Depends { name: "cpp" } files: [ "dllmain.cpp", ] }
dllmain.cpp
__declspec(dllexport) int test_returner () { return 123; }
The problem is, if run with QtCreator the program crashes before even starting, which is fixed by copying TestLib.dll over to the directory that contains TestApp.exe.
I would always do it this way (
Depends { name: LIBNAME }
) on my linux machine without any problems but I'm forced to windows for a while and I'm not sure if its a bug or if I have to do some additional/different stuff in my qbs files, hence my question: How do I fix it ?Thought about utilizing qbs'
destinationDirectory
property by setting it tosourceDirectory + "/../bin"
to fix the separate directory problem for exe and dll, but then I'm being trolled as it creates the folderdotdot/bin/
insourceDirectory
. -
@slyp said in QtCreator fails to run an application that depends on a library in the same project:
I would always do it this way ( Depends { name: LIBNAME } ) on my linux machine without any problems but I'm forced to windows for a while and I'm not sure if its a bug or if I have to do some additional/different stuff in my qbs files, hence my question: How do I fix it ?
yes, maybe a bug.
Can you pls post the generated makefile? -
@raven-worx said in QtCreator fails to run an application that depends on a library in the same project:
Can you pls post the generated makefile?
Can't find one
Andy@Andy-PC /cygdrive/d/Dev/TestProject/build-TestProject-Desktop_Qt_5_7_0_MSVC2015_32bit-Debug $ find . -print . ./qtc_Desktop__a1af886e-debug/qtc_Desktop__a1af886e-debug.bg ./qtc_Desktop__a1af886e-debug/qtc_Desktop__a1af886e-debug.bg.lock ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/.obj ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/.obj/3a52ce780950d4d9/main.cpp.obj ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/.obj/vc140.pdb ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/intermediate.TestApp.exe ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/intermediate.TestApp.exe.manifest ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/intermediate.TestApp.ilk ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/TestApp.exe ./qtc_Desktop__a1af886e-debug/TestApp.qtc-Desktop--a1af886e.73fd51ec/TestApp.pdb ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469 ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/.obj ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/.obj/3a52ce780950d4d9/dllmain.cpp.obj ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/.obj/vc140.pdb ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/TestLib.dll ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/TestLib.exp ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/TestLib.ilk ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/TestLib.lib ./qtc_Desktop__a1af886e-debug/TestLib.qtc-Desktop--a1af886e.2ecbf469/TestLib.pdb
Isn't qbs supposed to not rely on makefiles anymore ?
-
@slyp
sorry, wasn't really up-to-date with QBS.
QBS doesn't create makefiles of course.