Author Topic: help gcc  (Read 2633 times)

igi

  • Guest
help gcc
« on: June 14, 2007, 01:59:36 pm »
i write C++ sample code, then i compile with C:\PROGRA~1\CODEBL~1\bin>"mingw32-gcc.exe" -o helo.exe hello.cpp -Wno-deprecated
so appears :
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0xd): undefined reference to `std::string::size() const'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x60): undefined reference to `std::string::operator[](unsigned int) const'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x9f): undefined reference to `std::string::operator[](unsigned int) const'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0xce): undefined reference to `std::string::operator[](unsigned int) const'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x135): undefined reference to `std::cout'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x13a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <s
td::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char
 const*)'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x163): undefined ref
erence to `std::ios_base::Init::Init()'
C:\DOCUME~1\user\LOCALS~1\Temp/ccKEaaaa.o:hello.cpp:(.text+0x17e): undefined ref
erence to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status

what can i do to make this source successfully compile,

thx...

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: help gcc
« Reply #1 on: June 14, 2007, 03:34:34 pm »
Use g++ or mingw32-g++ instead of mingw32-gcc.

This question is barely Code::Blocks related -- and at any rate, C::B knows how to compile your program better than you do, so why aren't you using it?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)