[英]multiple definition of `DllMainCRTStartup@12' while building glew on windows with mingw32
I followed this topic: Building glew on windows with mingw but something went wrong here: 我跟着这个话题: 用mingw在windows上构建glew但是这里出了点问题:
gcc -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 gcc -shared -Wl,-soname,libglew32.dll -Wl, - out-implib,lib / libglew32.dll.a -o lib / glew32.dll src / glew.o -L / mingw / lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
I get this error: 我收到此错误:
C:\\MinGW\\dev_lib\\glew-2.0.0>gcc -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 src/glew.o:glew.c:(.text+0x28f80): multiple definition of `DllMainCRTStartup@12' c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../dllcrt2.o:(.text+0x60): first defined here collect2.exe: error: ld returned 1 exit status C:\\ MinGW \\ dev_lib \\ glew-2.0.0> gcc -shared -Wl,-soname,libglew32.dll -Wl, - out-implib,lib / libglew32.dll.a -o lib / glew32.dll src / glew.o -L / mingw / lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 src / glew.o:glew.c :(。text + 0x28f80):`DllMainCRTStartup @ 12'c的多重定义:/ mingw / bin /../lib/gcc/mingw32/4.9.3/../../../dllcrt2.o:(.text+0x60):首先在这里定义collect2.exe:错误:ld返回1退出状态
Thanks for help. 感谢帮助。
You need to link with the -nostdlib
option like so: 您需要链接
-nostdlib
选项,如下所示:
gcc -nostdlib -shared -Wl,-soname,libglew32.dll -Wl,--out-implib,lib/libglew32.dll.a -o lib/glew32.dll src/glew.o -L/mingw/lib -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
Glew defines DllMainCRTStartup which is also defined in the CRT. Glew定义了DllMainCRTStartup,它也在CRT中定义。 Hence your problem.
因此你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.