Menu

OpenGL

2007-08-14
2012-09-26
  • Nobody/Anonymous

    Windows XP
    Dev-C++ 4.9.9.2

    Downloaded and installed “glut”

    Compiling example from “OpenGL Programming Guide”

    include <gl/gl.h>

    include <gl/glut.h>

    Linker errors as follows :-
    C:\Dev-Cpp\MyDev\OpenGL\mainGL.o(.text+0x188) In function main': [Linker error] undefined reference toglutInit'
    [Linker error] undefined reference to glutInitDisplayMode' [Linker error] undefined reference toglutInitWindowSize'
    [Linker error] undefined reference to glutInitWindowPosition' [Linker error] undefined reference toglutCreateWindow'
    [Linker error] undefined reference to glutDisplayFunc' [Linker error] undefined reference toglutMainLoop'
    C:\Dev-Cpp\MyDev\OpenGL\mainGL.o(.text+0x188) ld returned 1 exit status
    C:\Dev-Cpp\MyDev\OpenGL\Makefile.win [Build Error] [Project1.exe] Error 1

    Project Options - Parameters - Linker reads -
    -lopengl32
    -glut32

    What have I overlooked ?

    Robert

     
    • Nobody/Anonymous

      Did you add the libraries in your project?

       
      • Wayne Keen

        Wayne Keen - 2007-08-14

        You do not add libraries to your project, you link them.

        Did you read the section in the "Please Read Before Posting a Question" thread on
        "Getting Started with Glut"? I think that will get you up and going.

        In addition, please read the section in there on the "Basic 3" - that is a better
        way than excerpting the information as you have done.

        Wayne

         
    • Nobody/Anonymous

      Thankyou for your reply.
      Yes, I've added glut32.a and glut.a found in the lib directory.

      Just in case I'm mistaken :-

      Project Options >
      Parameters >
      Linker >

      add library or object
      Now reads :
      -lopengl32 -lglu32
      -glut32 -glut

      Robert

       
    • Nobody/Anonymous

      Thankyou for your reply.
      Yes, I've added glut32.a and glut.a found in the lib directory.

      Just in case I'm mistaken :-

      Project Options >
      Parameters >
      Linker >

      add library or object button
      it now contains:

      -lopengl32
      -lglut32 -lglut

      Robert

       
      • Wayne Keen

        Wayne Keen - 2007-08-14

        Robert,

        PLEASE take a moment and look at the "Please Read" thread, in particular
        the section on the Basic 3. Contained in the compile log for example is
        information telling us exactly what was REALLY linked. While telling us
        what you did provides context that can be useful, information about what
        the compiler actually DID is far more important.

        The section on geting started with Glut tells you what to get, where to
        get it, and where to put it. This is important, because an inconsistent
        set of headers/libraries and dll's can lead to issues. It also gives an
        example, and tells you, step by step, how to compile it.

        You really need to look at those sections of the Please Read thread.

        Wayne

         
    • Nobody/Anonymous

      Thanks Wayne, followed your instructions all seems to be fine.
      Now have an extra option in New Project > Multimedia Section called GLUT
      Select this and away we go!

      I’ll try to do better next time, must be the Pattaya nights.

      Robert

       
      • Wayne Keen

        Wayne Keen - 2007-08-14

        Great! Glad to hear you are up and going.

        Some people react badly when I say they need to check something out in the
        "Please Read" thread - think I am lazy or something, but there really is a
        lot of experience of users in there that can help.

        There are a lot of ways to do this stuff wrong, and, trust me, I have sampled
        a lot of the wrong ways, with a bias towards those having additional stupidity
        involved. When I get it right, I try to write it up to give something to the
        community.

        Wayne

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.