-   Programming (
-   -   Compiling a program with gcc on Solaris (I think) (

phekno 09-15-2004 02:16 AM

Compiling a program with gcc on Solaris (I think)
I'm here at school working on a program for a networking class and am trying to remotely compile my program on a Sun machine. I'm not sure of the OS (SunOS 5.8 maybe?) so unless anyone has an idea as to how to check for that sort of a thing I cant help you. Anyway, I'm trying to compile this program and when I run gcc -o whatever whatever.c I get a nasty error which looks something like this:

$gcc -o whatever whatever.c
Undefined first referenced
symbol in file
socket /var/tmp/something.o
accept " "
bind " "
inet_ntoa " "
getsockname " "
listen " "
ld: fatal: Symbol referencing errors. No output written to server
collect2: ld returned 1 exit status

So there it is. The program compiles cleanly on a PC running slackware and one running Mandrake so what is the problem. Oh yeah, the prompt is:


which would indicate that I was using bash on the Sun system.

Any help would be greatly appreciated.


itsme86 09-15-2004 11:14 AM

uname -a

That should tell you the SunOS version. It's hard to say what the message might mean without more information. What's in whatever.c? What version of gcc is that (gcc --version)? It might be as simple as adding like -lsocket to the end of your compile line.

phekno 09-15-2004 02:39 PM

Yeah, I did uname -a and it showed SunOS 5.8. I don't remember what the gcc version was but I did manage to get the file compiled. The program was supposed to show the difference in endianness (sp?) between different systems. This program is for a class in computer networking (socket programming). Thanks for the help.


Oh yeah, all I had to do was add -lsocket and another library to the compile line.

All times are GMT -5. The time now is 11:27 AM.