[clug] sockets compiling advice

James Macnicol jamesm at ee.adfa.edu.au
Sat Jan 17 23:37:40 GMT 2004


> I don't see anything immediately, but I'd try making it a C 
> file and taking out the "using namespace" bit.

iffigenia(0):~% gcc p10.6.cxx  -o p10.6 -Wall -g
In file included from p10.6.cxx:4:
local_sock.h:6:1: warning: "_GNU_SOURCE" redefined
<command line>:4:1: warning: this is the location of the previous
definition
/tmp/ccrz1Lfa.o(.text+0x285): In function
`__static_initialization_and_destruction_0':
/usr/include/c++/3.3/iostream:77: undefined reference to
`std::ios_base::Init::Init[in-charge]()'
/tmp/ccrz1Lfa.o(.text+0x2b6): In function `__tcf_0':
/usr/include/c++/3.3/iostream:77: undefined reference to
`std::ios_base::Init::~Init [in-charge]()'
/tmp/ccrz1Lfa.o(.eh_frame+0x11): In function `main':
/home/jamesm/p10.6.cxx:15: undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
iffigenia(1):~% g++ p10.6.cxx  -o p10.6 -Wall -g
In file included from p10.6.cxx:4:
local_sock.h:6:1: warning: "_GNU_SOURCE" redefined
<command line>:4:1: warning: this is the location of the previous
definition
iffigenia(0):~%

	i.e. if you replace gcc with g++ on the command line it works.
Gcc isn't intelligent enough to figure out if source is C++ or not, you
really need to use the correct compiler.



James



More information about the linux mailing list