smozoma
August 5th, 2005, 04:44 AM
I'm new to trying to compile under Linux. It's giving me a rough rough time.
I'm writing "gcc *.cpp" at the command prompt in the directory with the files, but get this insane error : )
/tmp/ccg7SEX6.o(.text+0x5d): In function `Keyboard::Keyboard()':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0x86):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xaf): In function `Keyboard::Keyboard()':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0xd8):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
[......... and on and on for pages...]
/tmp/ccg7SEX6.o(.text+0x102): In function `Keyboard::Keyboard(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0x138):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0x14b):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0x189):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::at(unsigned int)'
/tmp/ccg7SEX6.o(.text+0x2f3):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0x320): In function `Keyboard::Keyboard(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/tmp/ccg7SEX6.o(.text+0xd5f):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccg7SEX6.o(.text+0xd71):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0xd82):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccg7SEX6.o(.text+0xd9f):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xdb9):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xdd3):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'_ZNSt6vectorI7PenaltySaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_[std::vector<Penalty, std::allocator<Penalty> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Penalty*, std::vector<Penalty, std::allocator<Penalty> > >, Penalty const&)]+0x3db):Score.cpp: undefined reference to `__cxa_rethrow'
/tmp/ccFH6gls.o(.gnu.linkonce.t._ZNSt6vectorI7PenaltySaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_[std::vector<Penalty, std::allocator<Penalty> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Penalty*, std::vector<Penalty, std::allocator<Penalty> > >, Penalty const&)]+0x3ec):Score.cpp: undefined reference to `__cxa_end_catch'
/tmp/ccFH6gls.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
I'm guessing I'm not initializing things to gcc's satisfaction? It works fine in VC++ .NET 2003. I'll go back into linux to try initializing things (no Internet in my Linux.. yet.. recompile kernel, blah blah..).
--
I also tried the windows version of gcc in cygwin and got something funny:
in Keyboard.h, i have
class Keyboard {
public:
const int static l_QWERTY = 0;
const int static l_DVORAK = 1;
[...]
and gcc (cygwin) complains:
Keyboard.h:43: error: declaration does not declare anything
Keyboard.h:43: error: parse error before `static'
then when I try to use those values in keyboard.cpp, it complains that they are undeclared : ).
So...confused...
I'm writing "gcc *.cpp" at the command prompt in the directory with the files, but get this insane error : )
/tmp/ccg7SEX6.o(.text+0x5d): In function `Keyboard::Keyboard()':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0x86):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xaf): In function `Keyboard::Keyboard()':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0xd8):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
[......... and on and on for pages...]
/tmp/ccg7SEX6.o(.text+0x102): In function `Keyboard::Keyboard(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()'/tmp/ccg7SEX6.o(.text+0x138):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0x14b):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0x189):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::at(unsigned int)'
/tmp/ccg7SEX6.o(.text+0x2f3):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0x320): In function `Keyboard::Keyboard(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/tmp/ccg7SEX6.o(.text+0xd5f):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccg7SEX6.o(.text+0xd71):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccg7SEX6.o(.text+0xd82):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/tmp/ccg7SEX6.o(.text+0xd9f):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xdb9):Keyboard.cpp: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/tmp/ccg7SEX6.o(.text+0xdd3):Keyboard.cpp: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'_ZNSt6vectorI7PenaltySaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_[std::vector<Penalty, std::allocator<Penalty> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Penalty*, std::vector<Penalty, std::allocator<Penalty> > >, Penalty const&)]+0x3db):Score.cpp: undefined reference to `__cxa_rethrow'
/tmp/ccFH6gls.o(.gnu.linkonce.t._ZNSt6vectorI7PenaltySaIS0_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS0_S2_EERKS0_[std::vector<Penalty, std::allocator<Penalty> >::_M_insert_aux(__gnu_cxx::__normal_iterator<Penalty*, std::vector<Penalty, std::allocator<Penalty> > >, Penalty const&)]+0x3ec):Score.cpp: undefined reference to `__cxa_end_catch'
/tmp/ccFH6gls.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
I'm guessing I'm not initializing things to gcc's satisfaction? It works fine in VC++ .NET 2003. I'll go back into linux to try initializing things (no Internet in my Linux.. yet.. recompile kernel, blah blah..).
--
I also tried the windows version of gcc in cygwin and got something funny:
in Keyboard.h, i have
class Keyboard {
public:
const int static l_QWERTY = 0;
const int static l_DVORAK = 1;
[...]
and gcc (cygwin) complains:
Keyboard.h:43: error: declaration does not declare anything
Keyboard.h:43: error: parse error before `static'
then when I try to use those values in keyboard.cpp, it complains that they are undeclared : ).
So...confused...