与 dev-c++ 的链接问题在 Windows 上
我正在接管一个用 Dev-C++ 开发的 C++ 项目(是的,我知道......):它编译得很好,但它不会链接,并且错误消息不是很有指示性:
Compiler: Default compiler
Building Makefile: "S:\Spirale 2\spiral2\conditionnement\trunk2011\Makefile.win"
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\spirale2.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_pulse.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_cb.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_daq.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_rs232.c
Executing make...
make.exe -f "S:\Spirale 2\spiral2\conditionnement\trunk2011\Makefile.win" all
g++.exe -D__DEBUG__ obj/spirale2.o obj/sp_pulse.o obj/sp_cb.o obj/sp_daq.o obj/sp_rs232.o obj/Spirale2_private.res -o "Spirale2.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/bin" -L"C:/RSSI/lib/msc" -L"C:/RSSI/lib/bc" -L"C:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/lib" -L"C:/Dev-Cpp/libiconv-1.9.1.bin.woe32/lib" -mwindows -lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lgdi32 -lole32 -luuid -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv -lrssism -g3
obj/spirale2.o: could not read symbols: Invalid argument
collect2: ld returned 1 exit status
make.exe: *** [Spirale2.exe] Error 1
Execution terminated
我分解了链接器的最后一条指令这里(每个选项一行,以提高可读性)并从命令行运行它:
c:/Dev-Cpp/libexec/gcc/mingw32/3.4.2/collect2.exe
--subsystem windows
-Bdynamic
-o Spirale2.exe
c:/Dev-Cpp/lib/crt2.o
c:/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtbegin.o
-LC:/Dev-Cpp/lib
-LC:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/bin
-LC:/RSSI/lib/msc
-LC:/RSSI/lib/bc
-LC:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/lib
-LC:/Dev-Cpp/libiconv-1.9.1.bin.woe32/lib
-Lc:/Dev-Cpp/lib/gcc/mingw32/3.4.2
-Lc:/Dev-Cpp/lib/gcc
-Lc:/Dev-Cpp/mingw32/lib
-Lc:/Dev-Cpp/lib
obj/spirale2.o
obj/sp_pulse.o
obj/sp_cb.o
obj/sp_daq.o
obj/sp_rs232.o
obj/Spirale2_private.res
-lgtk-win32-2.0
-lgdk-win32-2.0
-lgthread-2.0
-lgdi32
-lole32
-luuid
-latk-1.0
-lgdk_pixbuf-2.0
-lpangowin32-1.0
-lgdi32
-lpango-1.0
-lgobject-2.0
-lgmodule-2.0
-lglib-2.0
-lintl
-liconv
-lrssism
-lstdc++
-lmingw32
-lgcc
-lmoldname
-lmingwex
-lmsvcrt
-lgdi32
-lcomdlg32
-luser32
-lkernel32
-ladvapi32
-lshell32
-lmingw32
-lgcc
-lmoldname
-lmingwex
-lmsvcrt
c:/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtend.o
obj/spirale2.o: could not read symbols: Invalid argument
collect2: ld returned 1 exit status
我认为它可能是一个具有错误CPU架构的文件,但我检查了.o文件:
crt2.o: 80386 COFF executable not stripped - version 30821
crtbegin.o: 80386 COFF executable not stripped - version 30821
crtend.o: 80386 COFF executable not stripped - version 30821
sp_cb.o: 80386 COFF executable not stripped - version 30821
sp_daq.o: 80386 COFF executable not stripped - version 30821
spirale2.o: 80386 COFF executable not stripped - version 30821
sp_pulse.o: 80386 COFF executable not stripped - version 30821
sp_rs232.o: 80386 COFF executable not stripped - version 30821
有什么想法吗?谢谢。 就像我说的,该项目很旧,只需要进行一些修改,所以我真的不想升级所有内容!
I'm taking over a C++ project developed with Dev-C++ (yeah, I know...): it compiles fine but it won't link and the error message is not very indicative:
Compiler: Default compiler
Building Makefile: "S:\Spirale 2\spiral2\conditionnement\trunk2011\Makefile.win"
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\spirale2.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_pulse.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_cb.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_daq.cpp
Finding dependencies for file: S:\Spirale 2\spiral2\conditionnement\trunk2011\sp_rs232.c
Executing make...
make.exe -f "S:\Spirale 2\spiral2\conditionnement\trunk2011\Makefile.win" all
g++.exe -D__DEBUG__ obj/spirale2.o obj/sp_pulse.o obj/sp_cb.o obj/sp_daq.o obj/sp_rs232.o obj/Spirale2_private.res -o "Spirale2.exe" -L"C:/Dev-Cpp/lib" -L"C:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/bin" -L"C:/RSSI/lib/msc" -L"C:/RSSI/lib/bc" -L"C:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/lib" -L"C:/Dev-Cpp/libiconv-1.9.1.bin.woe32/lib" -mwindows -lgtk-win32-2.0 -lgdk-win32-2.0 -lgthread-2.0 -lgdi32 -lole32 -luuid -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv -lrssism -g3
obj/spirale2.o: could not read symbols: Invalid argument
collect2: ld returned 1 exit status
make.exe: *** [Spirale2.exe] Error 1
Execution terminated
I broke down the last instruction to the linker here (one line per option for readability) and ran it from the command line:
c:/Dev-Cpp/libexec/gcc/mingw32/3.4.2/collect2.exe
--subsystem windows
-Bdynamic
-o Spirale2.exe
c:/Dev-Cpp/lib/crt2.o
c:/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtbegin.o
-LC:/Dev-Cpp/lib
-LC:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/bin
-LC:/RSSI/lib/msc
-LC:/RSSI/lib/bc
-LC:/Dev-Cpp/gtk+-bundle_2.22.1-20101227_win32/lib
-LC:/Dev-Cpp/libiconv-1.9.1.bin.woe32/lib
-Lc:/Dev-Cpp/lib/gcc/mingw32/3.4.2
-Lc:/Dev-Cpp/lib/gcc
-Lc:/Dev-Cpp/mingw32/lib
-Lc:/Dev-Cpp/lib
obj/spirale2.o
obj/sp_pulse.o
obj/sp_cb.o
obj/sp_daq.o
obj/sp_rs232.o
obj/Spirale2_private.res
-lgtk-win32-2.0
-lgdk-win32-2.0
-lgthread-2.0
-lgdi32
-lole32
-luuid
-latk-1.0
-lgdk_pixbuf-2.0
-lpangowin32-1.0
-lgdi32
-lpango-1.0
-lgobject-2.0
-lgmodule-2.0
-lglib-2.0
-lintl
-liconv
-lrssism
-lstdc++
-lmingw32
-lgcc
-lmoldname
-lmingwex
-lmsvcrt
-lgdi32
-lcomdlg32
-luser32
-lkernel32
-ladvapi32
-lshell32
-lmingw32
-lgcc
-lmoldname
-lmingwex
-lmsvcrt
c:/Dev-Cpp/lib/gcc/mingw32/3.4.2/crtend.o
obj/spirale2.o: could not read symbols: Invalid argument
collect2: ld returned 1 exit status
I thought it might have been a file with the wrong CPU architecture, but I've checked the .o files:
crt2.o: 80386 COFF executable not stripped - version 30821
crtbegin.o: 80386 COFF executable not stripped - version 30821
crtend.o: 80386 COFF executable not stripped - version 30821
sp_cb.o: 80386 COFF executable not stripped - version 30821
sp_daq.o: 80386 COFF executable not stripped - version 30821
spirale2.o: 80386 COFF executable not stripped - version 30821
sp_pulse.o: 80386 COFF executable not stripped - version 30821
sp_rs232.o: 80386 COFF executable not stripped - version 30821
Any idea ? Thanks.
Like I said, the project is old and only needs a few modifications, so I don't really want to upgrade everything !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论