Undefined definitios when I try to compile a single file (GCC)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Undefined definitios when I try to compile a single file (GCC)

  1. #1
    Join Date
    Jun 2011
    Posts
    6

    Undefined definitios when I try to compile a single file (GCC)

    I'm not sure if this is the right place to post this, if it isn't I apologize.

    When I try to compile a single file with GCC (I'm using Code::Blocks as my IDE if that is relevant) it gives me a bunch of undefined reference errors. Well, of course they are undefined since I haven't linked anything yet, but why is GCC complaining at compiling time?
    The problem is that when I try to link and compile the project in one go I don't get any errors. So what am I doing wrong here?

    The references in question are from the GLEW library if that is relevant.

    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewDeleteBuffers'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewDeleteBuffers'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `glEnableClientState@4'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `glVertexPointer@16'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `glDrawElements@16'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `glDisableClientState@4'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `glGetError@0'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewGenBuffers'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBufferData'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewGenBuffers'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBufferData'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    src\charrenderer.o:charrenderer.cpp|| undefined reference to `_imp____glewBindBuffer'|
    ||=== Build finished: 17 errors, 0 warnings (0 minutes, 1 seconds) ===|

    Here are all the errors I get.
    Any help would be much appreciated, thank you in advance.

  2. #2
    Join Date
    Jun 2011
    Posts
    6

    Re: Undefined definitios when I try to compile a single file (GCC)

    Oh, I forgot to mention one more thing, this only happens with that file.

    If I try to build my main for instance (which also has references to GLEW), it builds fine.

    One more thing, why cant I edit my posts?

  3. #3
    Join Date
    Apr 1999
    Posts
    27,423

    Re: Undefined definitios when I try to compile a single file (GCC)

    Quote Originally Posted by ShiroAisu View Post
    I'm not sure if this is the right place to post this, if it isn't I apologize.

    When I try to compile a single file with GCC (I'm using Code::Blocks as my IDE if that is relevant) it gives me a bunch of undefined reference errors. Well, of course they are undefined since I haven't linked anything yet,
    It is the IDE that is responsible for calling the compiler and then the linker at the appropriate time. The errors are indeed linker errors, as only the linker gives those errors (and the linker from what I remember is ld).

    So your issue is with your IDE, IDE settings, or how you're using your IDE, not gcc or ld.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center