help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc vs g++


From: Chris
Subject: gcc vs g++
Date: 5 Jan 2006 00:17:17 -0800
User-agent: G2/0.2

I've been trying to compile some code.  When I type the following in
the command line, I get a bunch of errors:

cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
gcc struct.cpp test.cpp
/tmp/ccZ4eruw.o(.text+0x29): In function `Simple::displayInt()':
: undefined reference to `std::cout'
/tmp/ccZ4eruw.o(.text+0x2e): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >::operator<<(int)'
/tmp/ccZ4eruw.o(.text+0x36): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::endl<char, std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccZ4eruw.o(.text+0x3b): In function `Simple::displayInt()':
: undefined reference to `std::basic_ostream<char,
std::char_traits<char> >::operator<<(std::basic_ostream<char,
std::char_traits<char> >& (*)(std::basic_ostream<char,
std::char_traits<char> >&))'
/tmp/ccZ4eruw.o(.text+0x65): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccZ4eruw.o(.text+0x92): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccZ4eruw.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
/tmp/cc79ghVK.o(.text+0x49): In function
`__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/cc79ghVK.o(.text+0x76): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/cc79ghVK.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status

However, when I type g++, everything works well:

cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
g++ struct.cpp test.cpp
cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
ls
a.out  struct.cpp  struct.cpp~  struct.h  struct.h~  test.cpp
test.cpp~
cspears@bws-31:/imports/home/cspears/Documents/C++/myCode/chap04/ex04>
./a.out
5

Why is this?  I thought g++ and gcc were the same.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]