Link external library with MSCV compiler
-
All you have shown is a LIBS += ... line in a .pro file. When you compile (link) it must also show the actual command-line it has constructed and is executing using these, presumably in whatever "compiler output window" it has.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\DecaRangeRTLS.exe @C:\Users\FRHMELSA\AppData\Local\Temp\DecaRangeRTLS.exe.10468.50531.jom
x86
means 32-bit,x64
means 64-bit. Assuming from the names that those libraries you have are compiled 32-bit, you must compile everything else 32-bit (or get/compile 64-bit version of the libraries). The fact that you have a messagetarget machine type 'x64'
must indicate that somewhere you have told Qt Creator (the.pro
file?) that your target is 64-bit, and that does not look good....yes I have reached that assumption as well, but then how do I change the target machine type? :/
-
@elsa
I don't know in Qt Creator, but it can hardly be difficult, presumably you specify it at some point when you set up your project. Google for it.Unless the error is from one of your libraries already being compiled 64-bit. Check whether those libraries with
win32
in them are indeed 32-bit, not 64-bit.Come on, you can do this, I can't answer!
-
@elsa said in Link external library with MSCV compiler:
but then how do I change the target machine type?
Use Qt for that target machine type
-
@JonB @jsulm @mrjj I will try to start doing all the steps from scratch, because I am getting frustrated and cannot get on with the project because of this linker problem..
I am running Qt5.11.1. So what I read is that it only supports up to VS15, so I installed VS15. Qt, however, did not auto-detect the VS 14.0 compiler, so I had to add it manually. I found the path of the compiler .dll file but Qt also wants a make path (where is it?). This is where I am stuck now. Which make executable do I need for the compiler? and what else am I missing? I am sorry if my questions are to confusing or too easy. I am just trying to understand, because I never dealt with compilers and linkers in detail before and this problem came very unexpected. -
@elsa said in Link external library with MSCV compiler:
So what I read is that it only supports up to VS15
This is wrong - it supports VS17. But since VS15 and VS17 C++ compiler are compatible this does not matter. If you use Qt online installer you will see what compiler Qt 5.11.1 supports.
"but Qt also wants a make path" - can you please tell us exactly what it asks (screen-shot)?
If my understanding is correct the lib you want to use is built for x86, right? Official Qt build for Windows/VS are all x86_64. You will need a x86_64 build of that lib or build it by yourself.
-
This is a screenshot of the kit I am using now. This warning made me think that qt only supports VS15, but if it doesn't make a difference, then it's ok. This is now using the autodetected compiler (VS17), so I don't need to set up the path manually.
And yes the library is x86. -
@jsulm it produces this error:
f:\dd\vctools\crt\vcstartup\src\gs\gs_report.c:220: error: Debugger encountered an exception: Exception at 0xca9b99, code: 0xc0000409: , flags=0x1 (execution cannot be continued) f:\dd\vctools\crt\vcstartup\src\gs\gs_report.c:220: error: Debugger encountered an exception: Exception at 0xca9b99, code: 0xc0000409: , flags=0x1 (execution cannot be continued)
-
@jsulm
I commented some lines out to find the source of the problem and now it's producing the linking error again -.- This is the compile output:C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:debug\DecaRangeRTLS.exe @C:\Users\FRHMELSA\AppData\Local\Temp\DecaRangeRTLS.exe.5688.156.jom Qt53DExtrasd.lib(Qt53DExtrasd.dll) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64' jom: C:\Users\FRHMELSA\Documents\Projects\build-TREKdisplay-Desktop_Qt_5_11_1_MSVC2017_32bit-Debug\Makefile.Debug [debug\DecaRangeRTLS.exe] Error 1112 jom: C:\Users\FRHMELSA\Documents\Projects\build-TREKdisplay-Desktop_Qt_5_11_1_MSVC2017_32bit-Debug\Makefile [debug] Error 2 15:06:47: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2. Error while building/deploying project TREKdisplay (kit: Desktop Qt 5.11.1 MSVC2017 32bit) The kit Desktop Qt 5.11.1 MSVC2017 32bit has configuration issues which might be the root cause for this problem. When executing step "Make"
So the problem is with
Qt3DExtras
? Is this library 64bit? But this doesn't make sense right? Because whole Qt is 32bit and this is just part of it. -
Qt53DExtrasd.lib(Qt53DExtrasd.dll) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
So the problem is with Qt3DExtras? Is this library 64bit?I read this the other way round. I have searched this error and MS docs state it's a "version mismatch" but nowhere clarify which is which in the error message... :(
I believe this is saying:
Qt53DExtrasd
is a module which is compiledx86
(32-bit), but your overallLINK
is targettingx64
(64-bit).If that's the case, somehow your makefile/compilation/link is still targetting 64-bit when you want it to target 32-bit.... Make 100% sure that whatever the
qmake
generates (a makefile?) has no references to 64-bit but only to 32-bit, and that everything (of yours) is rebuilt from scratch. -