> i686-pc-mingw32-g++ -enable-stdcall-fixup -Wl,-enable-auto-importThis ------------------------------------------------------^^^^^^^^^^^^^
> -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -o ../lib/opencsg.lib
g++ doesn't create .lib files, it creates either .a or .dll libraries.
So what should I use to get a .lib file? I just want to test to see if it works. Actually, I probably do want a .a since I will be using this as a dependency to cross-compile other projects? My main goal is to cross-compile openscadpy (https://github.com/hmeyer/openscadpy
), which has a few dependencies.
The error you are seeing below just means g++ thinks its building an
executable, so it needs a main().
But the problem is really the .pro file, you don't show it in step 3,
but -qmake takes a .pro file and produces the Makefiles. The main
problem I see is the .pro file doesn't seem to specify that the target
is a library, not an application (otherwise Qt would just build a
library)... or you are using things wrong.
To make things clean I also suggest to not edit Makefile.release, all
your changes (those defines and libraries) should be made to the .pro
file, they can be Windows specific, you just have to add a guard.
I totally agree, but the .pro file seems to already be configured to compile a library.
TEMPLATE = lib
TARGET = opencsg
VERSION = 1.3.1
DESTDIR = ../lib
> object_script.opencsg.ReleaseYou can link it yourself (actually a static library doesn't even need to
> -lglew32s -lglu32 -lopengl32 -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32
> -lwinmm -lwinspool -ljpeg -lmng -llcms -ltiff -lmsimg32 -lQtCore -lpng
> -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -static-libgcc
> -lws2_32 -lz -Wl,--subsystem,windows
> undefined reference to address@hidden'
> Some googling suggested adding -Wl,--subsystem,windows to my args. I tried
> that but it didn't have any effect on the output so that's why you don't see
> it in my instructions. Any ideas what could be causing this? I don't see any
> references to main() or WinMain() anywhere in the opencsg code, so that has
> me pretty confused.
be linked, a dynamic one does), but the best way is to correct the .pro
file (which you didn't make, so you may pass that task to the original
How do I link it myself? I tried:
i686-pc-mingw32-g++ -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -o ../lib/libopencsg.a object_script.opencsg.Release -L'/home/brad/Downloads/mingw-cross-env/usr/i686-pc-mingw32/lib' -lglew32s -lglu32 -lopengl32 -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -ljpeg -lmng -llcms -ltiff -lmsimg32 -lQtCore -lpng -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz
(substituting opencsg.lib with libopencsg.a) But that gives the same error as before. I know you say I don't need to link glew but if I leave it out I get a large number of errors that look like this:
./release/frameBufferObject.o:frameBufferObject.cpp:(.text+0x14d): undefined reference to `___glewDeleteFramebuffers'
Along with the WinMain error.