linker error undefined reference to

This is a discussion on linker error undefined reference to within the C++ Programming forums, part of the General Programming Boards category; I am getting errors saying linker error undefined reference to (function name) what does this mean? How can I correct ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    61

    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
    Posts
    2,129
    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
    Location
    The edge of the known universe
    Posts
    32,823
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    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, 09:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 05: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, 12:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21