eclipse c++,通过CMD作品编译,在Eclipse中不可行
我使用Winsock库有一个TCP客户端程序(TCPCLIENT.CPP)。如果我将命令行与以下呼叫一起使用:
g++ TCPClient.cpp -o TCPClient.exe -lws2_32
当我尝试使用mingw中的eclipse/c ++链接相同的脚本时,成功生成了 *.exe,则我似乎会生成 *.o文件,但生成时会遇到错误*.exe。 因此,如果ecplise/c ++执行以下(链接器调用),则会生成错误:
g++ -o TCPClient.exe TCPClient.o -lws2_32
我得到多个错误:
输入c:\ mingw \ bin \ ld.exe:矮人错误:找不到abbrev编号84。
./src/tcpclient.o:cygming-crtbegin.c :(.text +0x2a0):
的多重定义 _mingw32_init_mainargs
c:/mingw/bin /../ lib/gcc/mingw32/6.3.0 /../../../../ crt2.o :(。text+0x2a0):首先定义此处 C:\ mingw \ bin \ ld.exe:矮人错误:找不到Abbrev编号84。 ./src/tcpclient.o:cygming-crtbegin.c :(.text +0x2e0):
的多重定义maincrtStartup'c:/mingw/bin /../ lib/gcc/mingw32/6.3.0 /../../../../../ crt2.o :(。text+0x2e0):首先在此处定义C: \ mingw \ bin \ ld.exe:矮人错误:找不到abbrev编号84 ../src/tcpclient.o:cygming-crtbegin.c :( .. text +0x300):
winmaincrtstartup' c:/mingw/bin /../ lib/gcc/mingw32/6.3.0 /../../../../../ crt2.o :(。text+0x300):首先在此处定义 C:\ mingw \ bin \ ld.exe:矮人错误:找不到Abbrev编号84。 ./src/tcpclient.o:cygming-crtbegin.c :(.text +0x320):atexit'c:/mingw/bin /../ lib/gcc/gcc/gcc/mingw32/6.3.0/的多个定义。 ./../../../../crt2.o :(.Text+0x320):首先在此处定义c:\ mingw \ bin \ ld.exe:dwarf错误:找不到abbrev编号84 ./ src/src/tcpclient.o :cygming-crtbegin.c :(。text+0x330):
_onexit的多重定义' c:/mingw/bin /../ lib/gcc/mingw32/6.3.0 /../../../../../ crt2.o :(。text+0x330):首先在此处定义 C:\ mingw \ bin \ ld.exe:矮人错误:找不到Abbrev编号84。 ./src/tcpclient.o:cygming-crtbegin.c :(.text +0x340):
的多重定义 '__gcc_register_frame' c:/mingw/bin /../ lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c :(。text+0x0):首先 在这里定义 c:\ mingw \ bin \ ld.exe:矮人错误:找不到abbrev编号84.here
c:\ mingw \ bin \ ld.exe:矮人错误 如果使用CMD线并首先生成.o文件,然后尝试生成一个 *.exe,则会遇到相同的错误。 CMD行中的以下两个调用导致上面的错误:
g++ TCPClient.o -o TCPClient.exe -lws2_32
g++ TCPClient.o -o TCPClient.exe
这意味着:如果在CMD行中,我只指定我要生成(A *.exe从我的 *.cpp中),一切正常。但是 - 作为用户 - 单独执行这两个步骤不起作用。
CMD线G ++调用似乎“知道”在这里该怎么做。作为用户,直接生成 *.exe时,我从未看到 *.o文件。但是我认为必须生成吗?我错了吗?为什么没有进一步规格的CMD线知道如何处理.o文件? ...是否可以从任何来源中找出对“ G ++”的调用,当通过命令行调用时会有什么?当然,我希望将相同的设置集成到Eclipse/C ++中。
I have a TCP Client program (TCPClient.cpp) using winsock library. An *.exe is generated successfully if I use command line with the following call:
g++ TCPClient.cpp -o TCPClient.exe -lws2_32
When I try to compile and link the same script within Eclipse/C++ using MinGW I seem to get the *.o file generated but I get an error when generating the *.exe.
Thus, the error is generated if Ecplise/C++ does the following (linker call):
g++ -o TCPClient.exe TCPClient.o -lws2_32
I get multiple errors:
enter C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.
./src/TCPClient.o:cygming-crtbegin.c:(.text+0x2a0): multiple definition of
_mingw32_init_mainargs
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2a0): first defined here
C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.
./src/TCPClient.o:cygming-crtbegin.c:(.text+0x2e0): multiple definition ofmainCRTStartup' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x2e0): first defined here C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84. ./src/TCPClient.o:cygming-crtbegin.c:(.text+0x300): multiple definition of
WinMainCRTStartup'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x300): first defined here
C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.
./src/TCPClient.o:cygming-crtbegin.c:(.text+0x320): multiple definition ofatexit' c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x320): first defined here C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84. ./src/TCPClient.o:cygming-crtbegin.c:(.text+0x330): multiple definition of
_onexit'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../crt2.o:(.text+0x330): first defined here
C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.
./src/TCPClient.o:cygming-crtbegin.c:(.text+0x340): multiple definition of
`__gcc_register_frame'
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x0): first
defined here
C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.here
The following is interesting:
I get the same errors if I use the cmd-line and first generate a .o file and then try to generate a *.exe. Both of the following calls in cmd-line result in the error from above:
g++ TCPClient.o -o TCPClient.exe -lws2_32
g++ TCPClient.o -o TCPClient.exe
This means: If in cmd-line I only specify that I want to generate (a *.exe from my *.cpp) everything works fine. But - as a user - doing those two steps separately does not work.
Cmd-Line g++ call seems to "know" what to do here. As a user I never see the *.o file when directly generating a *.exe. But I think it must be generated anyway? Am I wrong? Why does cmd-line without further specification know how to deal with the .o file? ... Is it possible to find out from any source what a call to "g++" does when called via command line? Of course I want the same settings integrated in eclipse/c++.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您执行-O(大写字母,而不是零),则可以获得该错误,而不是-o对于EXE文件。
You can get that error if you do -O (capital letter, not zero) instead of -o for the exe file.