Thread: Linking error: undefined reference

  1. #16
    Registered User
    Join Date
    May 2009
    Posts
    11
    Quote Originally Posted by brewbuck View Post
    Code:
    NodeFactory NodeFactory::nodeFactory;
    But this is conceptually WRONG, and will cause a linker error on the instructor's test system if he/she actually does provide this definition. You need to find out for sure.
    Awesome. That got rid of that error. Only for more to crop up.

    THANK YOU! I was looking at that one error for 5 hours. Even though it might be wrong. But yes, we are allowed to modify all the files. Phew.

    /cookies
    Last edited by somedude; 05-21-2009 at 12:46 PM.

  2. #17
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by somedude View Post
    Awesome. That got rid of that error. Only for more to crop up.

    THANK YOU! I was looking at that one error for 5 hours. Even though it might be wrong. But yes, we are allowed to modify all the files. Phew.

    /cookies
    Just to clarify why I think this is conceptually wrong...

    If the instructor is providing a class for you to plug into your code, then he/she should be providing everything. Declaring the static member is inappropriate, because you're just compensating for the incompleteness of an external module that SHOULD have been complete.

    Like I said, if the instructor links against some object that DOES provide the definition, your own definition will conflict with it. It's just sloppy, that's all.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

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