Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: igi on June 14, 2007, 01:59:36 pm

Title: help gcc
Post by: igi 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...
Title: Re: help gcc
Post by: TDragon 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?