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:
#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:
# 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?