gcc symbol reference error in Solaris


 
Thread Tools Search this Thread
Top Forums Programming gcc symbol reference error in Solaris
# 1  
Old 12-19-2010
gcc symbol reference error in Solaris

Hi there,

Honestly i'm not much of a code guy but i found some short piece of code over the net which i need to compile in my Solaris machine (in order to change my hostid).
As far as i read - i need to use the gcc to compile this short text file making it an executable file.

My problem is that when ever i tried to comile it - it's giving me some kind of an error related to undefined symbol reference which i have no idea what should i do to fix it !

Here is the code:
Code:
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
if(argc < 2)
{
fprintf(stderr,"Single argument: Target hostid\n",argv[0]);
return 1;
}
sethostid(
strtoul(argv[1],NULL,16) );
return 0;
}

When i run the gcc this is what i get:
Code:
# gcc <code text file>.c -o <filename>
Undefined first referenced
symbol in file
sethostid /var/tmp//ccEX9dSj.o
ld: fatal: Symbol referencing errors. No output written to <filename>
collect2: ld returned 1 exit status

As i mentioned, i'm not a developer so it might be something related to the C setup\environment on my server.
How can i check\verify everything required for comilng it exist\installed ?

Can someone please assist?

Moderator's Comments:
Mod Comment Cross post. Continued here

Last edited by Scott; 12-19-2010 at 05:16 PM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Solaris 11 patch cross reference file

Hi all I wanted to know does solaris 11 have any place to download patch cross-reference file like solaris 10 (h t t p s://getupdates.oracle.com/reports/patchdiag.xref)? I wanted to use this file to filter out those security patches and use it to check if any of my solaris 11 systems are... (0 Replies)
Discussion started by: kaze
0 Replies

2. Solaris

I got "undefined reference to" on gcc

Hell all I tryed to build rmp from sources on Solaris 10. I download source code, install gcc, binutils, and other packs с sunfreeware.com. Doring compilation I got an error: /bin/bash ./libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -fPIC -DPIC -D_REENTRANT -Wall... (0 Replies)
Discussion started by: sluge
0 Replies

3. Shell Programming and Scripting

symbol list reference

Can anyone direct me to a page that holds a list of perl's built in symbols? Example: $_ means blah $? means blah2 $! means blah3 (3 Replies)
Discussion started by: mrwatkin
3 Replies

4. Shell Programming and Scripting

Symbol reference

Hi, test -d .ssh || mkdir .ssh && chmod 700 .ssh The command has couple of symbols, could someone redirect me to the link, where i can understand their significance. Thanks, John (1 Reply)
Discussion started by: john_prince
1 Replies

5. Solaris

/usr/lib/passwdutil.so.1: symbol __nsl_fgetspent_r: referenced symbol not found

deleteing post (0 Replies)
Discussion started by: dshakey
0 Replies

6. Solaris

Symbol reference error for same code & libraries but compiled in different environmen

Hi All, I am having a code written in C++.First I build this code on SUN 5.10.It was built successfully.Following is the log when build was successful. -L/apps/compilers/SUNWspro/lib -lm -lsunmath \ -o App ld: warning: symbol `clog' has differing types: (file... (0 Replies)
Discussion started by: milindb
0 Replies

7. Solaris

gcc -3.4.6 solaris installation error

Hi , I am installing gcc 3.4.6 on SunOS labcvs001sm 5.9 Generic_117171-07 sun4u sparc SUNW,Ultra-5_10 . The isa info is 'sparcv'. I have the following with me a)gcc-3.4.6.tar b)gcc-3.4.6-sol9-sparc-local c)libiconv-1.11-sol9-sparc-local d) binutils-2.18.tar.gz e)... (8 Replies)
Discussion started by: sonu2die4
8 Replies

8. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders à /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) à pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

9. UNIX for Advanced & Expert Users

C++ Compiling error.. Symbol Reference

Undefined first referenced symbol in file std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator(unsigned int) const/var/tmp//cc9ACJBX.o std::basic_istream<char, std::char_traits<char> >& std::operator>><char,... (3 Replies)
Discussion started by: bjena
3 Replies

10. Solaris

solaris command reference

is there any good doc which explains the systems command reference manual for sun solaris for ex: related to memory disk space booting rsh enabling restarting LOM etc etc pls help... (1 Reply)
Discussion started by: gini
1 Replies
Login or Register to Ask a Question