Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-15-2004, 01:16 AM   #1
Registered: May 2003
Distribution: Gentoo, Slackware
Posts: 75

Rep: Reputation: 15
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.

Old 09-15-2004, 10:14 AM   #2
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
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.
Old 09-15-2004, 01:39 PM   #3
Registered: May 2003
Distribution: Gentoo, Slackware
Posts: 75

Original Poster
Rep: Reputation: 15
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Compiling a simple Hellow World on Solaris 9 with GCC 3.4.2 jitendra64 Solaris / OpenSolaris 4 10-11-2004 02:57 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 05:03 AM
gcc on Solaris g_goblin Solaris / OpenSolaris 7 10-30-2003 12:09 PM
How to I configure gcc on Solaris ehsan Solaris / OpenSolaris 5 01-08-2003 12:18 PM

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration