Getting undefined reference error from ZThread

This is a discussion on Getting undefined reference error from ZThread within the C++ Programming forums, part of the General Programming Boards category; Using MinGW 4.2.1, GCC 3.4.6. ZThread compiles fine into a library but when i compile a class using it, I ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    184

    Getting undefined reference error from ZThread

    Using MinGW 4.2.1, GCC 3.4.6.

    ZThread compiles fine into a library but when i compile a class using it, I get the errors:

    (ThreadLocalImpl.o):ThreadLocalImpl.cxx.text+0x8c):
    undefined reference to `std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_n ode_base*, std::_Rb_tree_node_base&)'

    undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'

    undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*) '

    undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*) '

    undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*) '

    undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base const*)'

    Do you have any idea what might be causing these?

    Thank you for any help you can give me,

    Don

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    You're not linking against the standard library, or against a wrong version.
    Could be:
    1) a badly set up IDE or compiler, not linking against the library
    2) a badly set up IDE or compiler, using a different compiler's standard headers
    3) a mismatch between the standard library this ZThread was compiled against and the one you're using now
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    184
    Quote Originally Posted by CornedBee View Post
    You're not linking against the standard library, or against a wrong version.
    Could be:
    1) a badly set up IDE or compiler, not linking against the library
    2) a badly set up IDE or compiler, using a different compiler's standard headers
    3) a mismatch between the standard library this ZThread was compiled against and the one you're using now
    Thanks.

    Hmmm... I compiled ZThreads with the same compiler so i don't think that's the problem. What's weird is when I compiled zthreads I got no issue but when i try to compile something using it, I get an issue.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Well, the compiler messages suggest that you're compiling ZThreads as a static library, in which case there would be no linking stage. Since these are linking errors, they wouldn't be apparent during the library creation.

    So, how about the compiler setup? Are you compiling on the command line or in an IDE? What is the exact command to the compiler?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

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. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 05:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM

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