Unsolved error LNK2038: mismatch detected for 'RuntimeLibrary' when trying to compile project with static built QT
So I wanted to static link/compile my qt project, since it is only 1 exe. I followed a tutorial on how to compile from source and a blog.
The configure command I used was:
configure.bat -release -static -static-runtime -no-pch -opensource -confirm-license -prefix "D:\Libraries\Qt\6.6.0\Build-Static" -skip webengine -nomake tests -nomake examples. The actual configuring, building and installing worked fine. But It's when I actually try to compile in Visual Studio 2022 that the problem comes up. I set the project to be statically linked (so RuntimeLibrary = MultiThreaded).
Here is an example error, it seems to say the same thing for every .lib and .obj file:
Qt6Widgets.lib(qtabwidget.cpp.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in main.obj
I do also want to add that if I set the project "RuntimeLibrary" to MultiThreaded DLL, the error shows the same except the values switch.
@Norzka Are you sure you're using your staticaly build Qt?
It looks like it's statically building. When I go into the directory, inside the bin folder there is no dlls, when I do the
lib /list some.lib, it shows how .obj files instead of .dll files. Weirdly enough, when I statically compile with the dynamic dll version of QT, it compiles fine, although it still requires the dlls.