C help

Started by
2 comments, last by DeathCarrot 16 years, 7 months ago
I am doing an assignment for my comp science class and I get everything to compile fine as indiviual files but when I try to link them nothing happens and I cant edit the compiler cause it on a remote computer and we are using shell /tmp/ccSncJdl.o(.text+0x19): In function `main': : undefined reference to `ReadData' collect2: ld returned 1 exit status Any help would be appericated
Advertisement
Looks like you're not linking the .o file which contains the function ReadData. What command are you using?
I am using gcc main.c and then we are instructed u use ./a.out to run the program we are using SSH Secure File Transfer to access all this on a computer at school.
For linking you need to specify all of your files in the same command.

i.e. To compile and link in one step:
gcc main.c somefile.c otherfile.c./a.out

or to compile and link separately:
gcc -c main.cgcc -c somefile.cgcc -c otherfile.cgcc main.o somefile.o otherfile.o./a.out

This topic is closed to new replies.

Advertisement