LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 09-15-2004, 02:16 AM   #1
phekno
Member
 
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:

bash-2.05a$

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

Any help would be greatly appreciated.

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

Rep: Reputation: 58
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, 02:39 PM   #3
phekno
Member
 
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.

Thanks,
Phekno

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


Reply


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 03:57 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 12:38 PM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 06:03 AM
gcc on Solaris g_goblin Solaris / OpenSolaris 7 10-30-2003 01:09 PM
How to I configure gcc on Solaris ehsan Solaris / OpenSolaris 5 01-08-2003 01:18 PM


All times are GMT -5. The time now is 12:11 PM.

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