-
g++ undefined refernce
hey guys..
been a while since i've been here..but I need some help.
This is driving me nuts, I'm getting an "undefined reference" error, but all the function prototypes and the code is there. Here's the command line I"m usingL
g++ *.cpp -L/usr/local/ssl/lib -lcrypto -L/usr/lib -lnsl -ldl -lc -lm -c eti
Here's the errors:
# g++ *.cpp -L/usr/local/ssl/lib -lcrypto -L/usr/lib -o eti
/tmp/ccvXWf45.o(.text+0x236): In function `MyProc(int, char**, pthread_mutex_t)':
: undefined reference to `_STI_GetBalance(char*, long*, unsigned short)'
/tmp/ccvXWf45.o(.text+0x27d): In function `MyProc(int, char**, pthread_mutex_t)':
: undefined reference to `_STI_DebitAccountCode(char*, long, unsigned long, unsigned short, unsigned long*, unsigned long, char*, unsigned long)'
/tmp/ccvXWf45.o(.text+0x2b8): In function `MyProc(int, char**, pthread_mutex_t)':
: undefined reference to `_STI_GetBalanceCode(char*, long*, unsigned short, unsigned long, char*, unsigned long)'
/tmp/ccvXWf45.o(.text+0x2f9): In function `MyProc(int, char**, pthread_mutex_t)':
: undefined reference to `_STI_CreditAccountCode(char*, long, unsigned long, unsigned short, unsigned long, char*, unsigned long)'
/tmp/ccvXWf45.o(.text+0x334): In function `MyProc(int, char**, pthread_mutex_t)':
: undefined reference to `_STI_GetBalanceCode(char*, long*, unsigned short, unsigned long, char*, unsigned long)'
collect2: ld returned 1 exit status
Any ideas?
-
If you could show us the function prototype/definition for the GetBalance function, we might be able to better help you. Since there is no compiler error, just a link error, it seems that there is a prototype -- the function is declared -- but no definition in the object files being linked -- either it's in another source or object file that you've forgotten to include, or there's a typeographic error in the actual function definition in the file so that the function in question does not match the expected name and argument type signature.
Edit:
I re-read the original post. I think it's most likely that some object file (or source file, for that matter) is not being included -- I suspect that all of the missing definitions are in some other source file.
-
actually nvm, i took care of it. it was an issue with #defines, it wasn't properly parsing it