Thread: g++ undefined refernce

  1. #1
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455

    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?

  2. #2
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    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.
    Last edited by filker0; 10-10-2005 at 03:10 PM. Reason: Reread the question

  3. #3
    i want wookie cookies the Wookie's Avatar
    Join Date
    Oct 2002
    Posts
    455
    actually nvm, i took care of it. it was an issue with #defines, it wasn't properly parsing it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. Problem with OpenGL tutorial
    By 2Biaz in forum Windows Programming
    Replies: 18
    Last Post: 09-16-2004, 11:02 AM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM