Quite strange MinGW ld problem - “collect2: ld returned 1 exit status”

。_饼干妹妹 提交于 2021-02-11 18:07:45

问题


I'm building an application for data visualization and the framework I'm using is beautiful OpenFrameworks. On Linux, it compiles and works perfectly, but now it's time to port it to Windows and I'm facing some very strange problems. I can't find relevant information from google. When linking, I get this:

mingw32-g++.exe  -o bin\visualisation.exe ...blah.o, blah2.o... ...lib1 lib2 lib3...
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 3 seconds)
0 errors, 0 warnings

(list of object files an libraries is quite long, so I stripped it a bit)

I tried manually building all libraries from scratch and then trying again, but I always get this. No errors, it just doesn't create any executables. It is usually problem with not included library, but then linker gives an error. I also tried to build all from command line, and I get the same result.

So, my question is pretty obvious, where can be the problem?

Just to mention, I'm using Code::Blocks 8.02, Windows XP Home SP3 and MinGW with following components:

gcc-core-3.4.5-20060117-1-vista.tar.gz 
gcc-g++-3.4.5-20060117-1-vista.tar.gz 
mingw-runtime-3.14.tar.gz 
mingw32-make-3.81-2.tar.gz
mingw-utils-0.3.tar.gz
w32api-3.11.tar.gz
binutils-2.18.50-20080109.tar.gz
gdb-6.7.50.20071127-mingw.tar.bz2

Edit: Log when compiling from command line (cmd.exe):

C:\openFrameworks\apps\examples\GraphVisualOFv2>mingw32-g++.exe  -o     bin\visualisation.exe obj\release\src\dataAccess\DBDataLoader.o obj\release\src\dataAccess\DataLoader.o obj\release\src\dataAccess\XMLDataLoader.o obj\release\src\dataAccess\c\sacapidll.o obj\release\src\engine\Engine.o obj\release\src\engine\config\Configuration.o obj\release\src\engine\config\ConfigurationControler.o obj\release\src\graph\Edge.o obj\release\src\graph\Graph.o obj\release\src\graph\Vertex.o obj\release\src\main.o obj\release\src\math\AlgorithmicPositioning.o obj\release\src\math\Positioning.o obj\release\src\math\RandomPositioning.o obj\release\src\metaLayer\MetaEdge.o obj\release\src\metaLayer\MetaGraph.o obj\release\src\metaLayer\MetaVertex.o obj\release\src\testApp.o   ../../../libs/openFrameworksCompiled/lib/win_cb/openFrameworks.lib ../../../libs/FreeImage/lib/win_cb/FreeImage.lib ../../../libs/rtAudio/lib/win_cb/librtaudio.a ../../../libs/rtAudio/lib/win_cb/RtAudio.a ../../../libs/rtAudio/lib/win_cb/RtAudioD.a ../../../libs/quicktime/lib/win_cb/qtmlClient.lib ../../../libs/freetype/lib/win_cb/libfreetype.a ../../../libs/glut/lib/win_cb/libglut.a ../../../libs/videoInput/lib/win_cb/videoInputLib.a ../../../libs/fmodex/lib/win_cb/libfmodex.a ../../../libs/glee/lib/win_cb/GLee.lib ../../../libs/glew/lib/win_cb/glew32s.lib ../../../libs/glu/lib/win_cb/glu32.lib ../../../libs/poco/lib/win_cb/libPocoNetmt.a ../../../libs/poco/lib/win_cb/libPocoUtilmt.a ../../../libs/poco/lib/win_cb/libPocoXMLmt.a ../../../libs/poco/lib/win_cb/libPocoFoundationmt.a ../../../libs/asa/lib/win_cb/dbcapi.lib ../../../libs/asa/lib/win_cb/dbextenv11.lib ../../../libs/asa/lib/win_cb/dblibtm.lib ../../../libs/asa/lib/win_cb/dbmlsynccli11.lib ../../../libs/asa/lib/win_cb/dbtlstm.lib ../../../libs/asa/lib/win_cb/odbc32.lib ../../../libs/asa/lib/win_cb/qany11.lib ../../../libs/dlfcn/lib/libdl.a ../../../libs/rudeconfig/lib/librudeconfig.a ../../../libs/freeglut/lib/libfreeglut.a -lopengl32 -lglu32 -ldsound -lwinmm -ldxguid -lstrmbase -lstrmiids -lz -luuid -lole32 -loleaut32 -lsetupapi -lwsock32 -lws2_32 -lIphlpapi
collect2: ld returned 1 exit status

C:\openFrameworks\apps\examples\GraphVisualOFv2>

回答1:


I found a solution by setting up an environment to directly call ld.exe with

-verbose

flag and got tons of information. I actually forgot to setup opengl32 development libraries, so linker could not find them.



来源:https://stackoverflow.com/questions/5530367/quite-strange-mingw-ld-problem-collect2-ld-returned-1-exit-status

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!