Undefined symbol

"Muñoz, Enrique (Laninfo)" Enmunoz@lanchile.cl
Thu Jun 12 22:37:00 GMT 2003


I am trying to compile a C++ program that use STL.  The program source code
is:

#include <stdio.h>
#include <string>
#include <iostream>


using namespace std;

int main(void) {
   static const string message = "mensaje de prueba";

   cout << "message = " << message << endl;

   return 1;
}


When I use g++ compiler, I just get undefined reference errors.

/var/tmp/cc4QV8B7.o: In function
`std::_Format_cache<char>::_S_get(std::ios_base&)':
/var/tmp/cc4QV8B7.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE6_S_getERSt8ios_b
ase+0x84): undefined reference to
`std::_Format_cache<char>::_Format_cache()'
/var/tmp/cc4QV8B7.o: In function
`std::_Format_cache<char>::_S_callback(std::ios_base::event, std::ios_base&,
int)':
/var/tmp/cc4QV8B7.o(.gnu.linkonce.t._ZNSt13_Format_cacheIcE11_S_callbackENSt
8ios_base5eventERS1_i+0xe8): undefined reference to
`std::_Format_cache<char>::_Format_cache()'
collect2: ld returned 1 exit status

program versions:
gcc= 3.0.2

Can you help me please.

Thank you
Enrique Muñoz



More information about the Gcc-help mailing list