Mail Archives: djgpp/1998/03/23/16:18:29
Good afternoon,
I have problem with linking class String (from _string.h), while other classes from libgpp.a links ok. I'm using gcc 2.8.0 with lgpp 2.8.0.
Here is my sample program (test.cpp):
#include <_String.h>
#include <iostream.h>
main() {
String s("blabla");
String s1;
s1 = "huhu";
cout << s << "\\n" << s1 << "\\n";
cout << s.at(2,6) << "\\n";
}
and here are linker messages (after "gcc -o test.exe -lgpp -lstdcxx test.o"):
Creating: test.exe
Error: test.o: In function `main':
test.cpp(1) Error: undefined reference to `String::String(char const *)'
test.cpp:4: undefined reference to `String::operator=(char const *)'
test.cpp:6: undefined reference to `cout'
test.cpp(.text+0x7a): undefined reference to `operator<<(ostream &, String const &)'
test.cpp(.text+0x85): undefined reference to `ostream::operator<<(char const *)'
test.cpp(.text+0x90): undefined reference to `operator<<(ostream &, String const &)'
test.cpp(.text+0x9b): undefined reference to `ostream::operator<<(char const *)'
test.cpp:7: undefined reference to `String::at(int, int)'
test.cpp(.text+0xc2): undefined reference to `cout'
test.cpp(.text+0xc7): undefined reference to `operator<<(ostream &, SubString const &)'
test.cpp(.text+0xd2): undefined reference to `ostream::operator<<(char const *)'
test.cpp(.text+0xeb): undefined reference to `SubString::~SubString(void)'
test.cpp(.text+0xff): undefined reference to `String::~String(void)'
test.cpp(.text+0x113): undefined reference to `String::~String(void)'
test.cpp(.text+0x12b): undefined reference to `SubString::~SubString(void)'
test.cpp(.text+0x14b): undefined reference to `String::~String(void)'
test.cpp(.text+0x16b): undefined reference to `String::~String(void)'
Thank you very much for your help.
David Stegbauer
- Raw text -