compiling with gcc and "undefined reference to xxx"
I have run up against a wall. I really appreciate any and all help because I am so out of my depth.
I have installed gcc on a NSLU2.
Running gcc -o test test.c brings no error and afterwards I can run the program test with ./test.
test.c
#include <stdio.h>
main()
{
printf("Linuxquestions.org\n");
}
so it seems I did something correct.
But when I try to compile the file that I really want to use "vclient.c" I get an error message
/tmp/ccuuPxtN.o(.text+0x3bc): In function `main': vclient.c: undefined reference to `initLog'
Now as I may have mentioned I am a long way out of my depth but I looked in the source code and found
#include "common.h"
common.h is in the directory and is obviously being found because if I add another m to make it commmon.h then the compiler complains that it can not find it.
When I look in common.h I find
int initLog(int useSyslog, char *logfile,int debugSwitch);
and looking in common.c (also in the same directory) I find
int initLog(int useSyslog, char *logfile,int debugSwitch) {
/* oeffnet bei Bedarf syslog oder log-Datei */
xxxxxxxxxxxxxxxxxx
}
where xxxx is code.
So to me everything looks OK!
But obviously I am missing something fundamental.
As I wrote, I really would appreciate any help.
Thank you
Neill
I am a newbie. I have been for many years now. Sometimes I feel that I understand things, turn the corner and find that there is even more to understand.
Bookmarks