问题描述
我遵循这个主题:但是在这里出了问题:
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
我得到这个错误:
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退出状态
感谢您的帮助。
您需要链接 -nost dlib
选项如下:
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定义了在CRT中定义的DllMainCRTStartup。因此你的问题。
I followed this topic: Building glew on windows with mingw but something went wrong here:
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 -lkernel32src/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 herecollect2.exe: error: ld returned 1 exit status
Thanks for help.
You need to link with the -nostdlib
option like so:
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. Hence your problem.
这篇关于使用mingw32在窗口上构建多个DllMainCRTStartup @ 12的多重定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!