Question

I know, I dug the whole internet to find out what the problem is and nothing has been helpful so far.

I am on Windows 7, using:

Qt 4.8.3: https://download.qt.io/archive/qt/4.8/4.8.3/qt-win-opensource-4.8.3-mingw.exe
MinGW32 4.4.0: http://nosymbolfound.blogspot.com/2012/12/since-until-now-qt-under-windows-is.html

I can compile any Qt demo example with Qt Creator, so I believe my system is working fine.
When trying to compile the program I ran into the well known issue:

g++ -enable-auto-import -o libqlcengine.a object_script.libqlcengine.Debug  -L".\lib" -L"c:\Qt\4.8.3\lib" -lwinmm -L../../hotplugmonitor/src -lhotplugmonitor -lQtScriptd4 -lQtXmld4 -lQtGuid4 -lQtCored4
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'

(object_script.libqlcengine.Debug is a pretty long list of .o files)
Now, at that point of build it's trying to link a static .a library, so I see no reason for MinGW to look for WinMain. I did grep 'WinMain' and found no result on the entire source tree.

If you want to checkout the original sources:

svn co https://qlc.svn.sourceforge.net/svnroot/qlc qlc

Or my forked version:

git clone git://git.code.sf.net/p/qlcplus/code qlcplus-code

They have the same result.
Guys, what am I missing here ? I tried a whole bunch of C flags (-mwindows -lmingw32 -DQT_NEEDS_MAIN -lqtmain) but none worked.

Any magic please ?

P.S. Of course I can build on Linux either i386/amd64

SOLVED:

I just needed to add the following line to the .pro files where libraries were created:

win32:QMAKE_LFLAGS += -shared
Was it helpful?

Solution

[SOLVED]

I just figured out I needed to add the following line to the .pro files where libraries were created:

win32:QMAKE_LFLAGS += -shared
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top