News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

help gcc

Started by igi, June 14, 2007, 01:59:36 PM

Previous topic - Next topic

igi

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...

TDragon

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?
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)