Linking error

This is a discussion on Linking error within the C++ Programming forums, part of the General Programming Boards category; The problem is that I am getting Code: undefined reference to `IssueQueue::full()' undefined reference to `IssueQueue::full()' undefined reference to `IssueQueue::empty()' ...

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    48

    Linking error

    The problem is that I am getting
    Code:
    undefined reference to `IssueQueue::full()'
    undefined reference to `IssueQueue::full()'
    undefined reference to `IssueQueue::empty()'
    undefined reference to `IssueQueue::empty()'
    when compiling. I have been trying to figure this one out for over an hour and hopefully some of you here are willing to look at this with some fresh eyes.

    What's really weird is that I call the IssueQueue constructor and another function before the first call to full, as well as other functions throughout main. It is only these two functions that the linker is having a problem with and it is all instances of them. I removed the four places that I call these two functions and everything compiles and runs beautifully.

    ...

    dynamic_scheduler.h only includes the prototype for fetchInstruction and dynamic_scheduler.cpp defines it. Like I said, if I remove those four lines that I commented in main then everything compiles fine. So why would some functions be able to be linked and not others?

    I am using an IDE which has been compiling fine previously but I have also tried by hand with "g++ -o out classes.cpp dynamic_scheduler.cpp prototype.cpp" as well as used a makefile that pretty much did the same.

    I've tried renaming full and empty in case the linker was getting confused with functions from another class in classes.h (one other does have full and empty as well) but same error.

    Any help would be appreciated.

    EDIT: Removed code. I found the cause. It was these two functions being inlined and probably optimized down into no code or something.
    Last edited by BdON003; 11-21-2009 at 11:34 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

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