Mail Archives: djgpp/2000/06/01/22:36:03
Hello. I have a question, and it doesn't seem to be in the DJGPP FAQ
somewhere. It's about namespaces in C++. Why is it that when I use the
gcc --honor-std option, the linker complains of unable to resolve an
external called ``std::terminate()''. The standard ``hello world''
program compiles without problems, but I am making this program which
uses the STL included with gpp2952b.zip. Whenever I build it using the
``--honor-std'' switch, the linker complains about unresolved externals.
But when I remove the ``--honor-std'' switch, the program compiles and
links without any errors. What am I doing wrong? Is it a problem with
the STL library archive?
Here's a sample:
#include <array>
#include <iostream>
using namespace std;
int main()
{
int_vec.reserve(10);
int i;
for (i=0; i<10; i++)
int_vec[i] = i*100;
for (i=0; i<10; i++)
cout << "int_vec[" << i << "]=" << int_vec[i] << endl;
return 0;
}
And then, on the command line:
$ gxx -o test.exe test.cc --honor-std
g:/tmp\cc3K9ANh.o(.text+0x1f1):test.cc: undefined reference to
`std::terminate(void)'
g:/tmp\cc3K9ANh.o(.text+0x6f6):test.cc: undefined reference to
`std::terminate(void)'
g:/tmp\cc3K9ANh.o(.text+0x748):test.cc: undefined reference to
`std::terminate(void)'
g:/tmp\cc3K9ANh.o(.text+0x7e1):test.cc: undefined reference to
`std::terminate(void)'
g:/tmp\cc3K9ANh.o(.text+0xb21):test.cc: undefined reference to
`std::terminate(void)'
collect2: ld returned 1 exit status
The same thing happens when using ``gcc'' instead of ``gxx''.
----------------
_nimrod_a_abing_
------------------------------------------
Homepage: http://www.geocities.com/n_abing
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
- Raw text -