gpt4 book ai didi

c++ - 很奇怪的 MinGW ld 问题 - "collect2: ld returned 1 exit status"

转载 作者:行者123 更新时间:2023-11-28 08:21:53 26 4
gpt4 key购买 nike

我正在构建一个数据可视化应用程序,我使用的框架很漂亮 OpenFrameworks .在 Linux 上,它可以完美地编译和运行,但现在是时候将它移植到 Windows 上了,我遇到了一些非常奇怪的问题。我无法从谷歌找到相关信息。链接时,我得到这个:

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

(库的目标文件列表很长,所以我把它去掉了一点)

我尝试从头开始手动构建所有库,然后再试一次,但我总能做到这一点。没有错误,它只是不创建任何可执行文件。通常是不包含库的问题,但链接器会给出错误。我还尝试从命令行构建所有内容,但得到了相同的结果。

所以,我的问题很明显,问题出在哪里?

顺便提一下,我使用的是 Code::Blocks 8.02、Windows XP Home SP3 和 MinGW 以及以下组件:

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

编辑:从命令行 (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>

最佳答案

我通过设置环境直接调用ld.exe找到了解决方案

-verbose

标记并获得大量信息。我实际上忘记设置 opengl32 开发库,所以链接器找不到它们。

关于c++ - 很奇怪的 MinGW ld 问题 - "collect2: ld returned 1 exit status",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5530367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com