title: Eclipse C++, Compiling via cmd works, compilling in eclipse does not
body: <p>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:</p>
  <pre><code>g++ TCPClient.cpp -o TCPClient.exe -lws2_32
  </code></pre>
  <p>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):</p>
  <pre><code>g++ -o TCPClient.exe TCPClient.o -lws2_32 
  </code></pre>
  <p>I get multiple errors:</p>
  <blockquote>
  <p>enter C:\MinGW\bin\ld.exe: Dwarf Error: Could not find abbrev number 84.<br />
  ./src/TCPClient.o:cygming-crtbegin.c:(.text+0x2a0): multiple definition of<br />
  _mingw32_init_mainargs<br />
  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 of<br />
  <code>mainCRTStartup' 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     </code>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 of <code>atexit' 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 </code>_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<br />
  `__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</p>
  </blockquote>
  <p>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:</p>
  <pre><code>g++ TCPClient.o -o TCPClient.exe -lws2_32
  
  g++ TCPClient.o -o TCPClient.exe 
  </code></pre>
  <p>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.</p>
  <p>Cmd-Line g++ call seems to &quot;know&quot; 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 &quot;g++&quot; does when called via command line? Of course I want the same settings integrated in eclipse/c++.</p>