I have been working on a Qt project using MinGW with Qt Creator under Windows. The Qt is used as a shared library, thus DLLs are needed to be copy to the distribution folder. However, a couple of members in our teams required that to be a standalone executable and use MSVC as compiler. We have a Qt library that was built statically according to whoever built it.
I would love to use Qt Creator as before. As some people suggested, I addedCONFIG += static
into my .pro file. However, when I select the qmake.exe under bin folder of static Qt library in the build settings, it always complains Qt version not valid and not properly installed. I tried to override some environment variables, which don't help either.This method should just work according to various posts on the internet and on Qt's Wiki. I am not sure why it does not work in my case.
I also have tried to use qmake from command line. However, whenever I make the project it always looks to the valid Qt shared library that is local installed on my PC. And the result of this, is still a executable with the need to copy DLLs.
The only way by which I can get it to build is to use the method suggested here:Using Qt with Visual Studio without add-in.
Basically it is to use qmake on .pro with template += vcapp
set. Then use visual studio with the generated .vcproj file to build the project. I don't really like this approach, as even the generated .vcproj doesn't default the inclusion and lib path to the static Qt lib but the shared Qt. Every time I generate it, I have to change it. It seems only to work with Debug build as well.
I am wondering is there a simpler way to do build a standalone exe against a static Qt library, preferably using Qt Creator? Our visual studio is express version, so no Qt Add-in available.