[clug] sockets compiling advice

Michael Cohen michael.cohen at netspeed.com.au
Sun Jan 18 00:28:49 GMT 2004


Adrian,
   This source is in c++ so its best to use the g++ compiler like:

   g++ -Wall -g p10.6.cxx

   It will warn about a redefine of _GNU_SOURCE, you should probably put that 
inside an ifdef.

Michael.

On Sun, 18 Jan 2004 10:52 am, Adrian Blake wrote:
> I have cut & pasted some code from a book but have trouble compiling.
> The following are the messages:
>
> 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
> p10.6.cxx:1:1: warning: this is the location of the previous definition
> /tmp/ccbmWDOI.o: In function `__static_initialization_and_destruction_0':
> /usr/include/c++/3.2/iostream:62: undefined reference to
> `std::ios_base::Init::Init[in-charge]()'
> /tmp/ccbmWDOI.o: In function `__tcf_0':
> /usr/include/c++/3.2/iostream:62: undefined reference to
> `std::ios_base::Init::~Init [in-charge]()'
> /tmp/ccbmWDOI.o: In function `main':
> /home/adrian/ipc/chapt_10/p10.6.cxx:15: undefined reference to
> `__gxx_personality_v0'
> collect2: ld returned 1 exit status
>
> The two source files are attached. Please advise me on what is required
> to compile this correctly
>
> Adrian



More information about the linux mailing list