I want the users to be able to re-link my Qt-using application to their own build of Qt, without being forced to rebuild all of the sources. This could be used for LGPL compliance, for example. To do this, I need to provide object files for all of my sources. To make it easy, using qmake, I've partitioned the project internally into:
A static library project that contains objects for all of the source files, including the file that has int main(int, char**)
.
An application project that links the static library above with Qt. Qt may be either a static library or dynamic. There are no source files for this project.
I then distribute the static library (.lib) and the application project file so that anyone can relink the application with their own version of Qt, in whichever fashion they prefer (either statically linked Qt or dynamically linked Qt), as long as they have the necessary version of MSVC.
I'm doing the build under both MSVC 2008 (Qt 4) and 2012 (Qt 5). The makefiles are generated by qmake.
The problem is that the linking fails when building the application project.
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
As soon as I add a dummy source file dummy.cpp
to the application project, the linking succeeds. Is there a way of avoiding this workaround?
//dummy.cpp (this is the entire source)
int dummy;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…