Thread: linker error undefined reference to

  1. #1
    Registered User
    Join Date
    Jun 2007

    Question linker error undefined reference to

    I am getting errors saying linker error undefined reference to (function name)
    what does this mean? How can I correct it?

  2. #2
    Registered User
    Join Date
    Oct 2001
    it means you didn't write out what that function did, or you didn't link in the correct library.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    It means one of these (typically)
    - you need to write the function.
    - you need to check the spelling - C++ is case sensitive, so 'foo' is different from 'Foo'.
    - you need to check the parameters - declaring foo(int a) and defining foo(double a) are different functions.
    - you forgot to specify the name of a library.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Jan 2005
    It could also mean that you forgot to include in the project the file that has the function definition.
    Or if the function is a member function of a class, perhaps you forgot the ClassName:: in the definition.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Problem with OpenGL tutorial
    By 2Biaz in forum Windows Programming
    Replies: 18
    Last Post: 09-16-2004, 11:02 AM