OpenGL with Windows 7

Discussion in 'C Programming' started by ldries46, Jan 24, 2011.

  1. ldries46

    ldries46 Guest

    I'm trying to understand how to program OpenGL in a Windows 7 environment.
    Now I get the error message: Undefined reference to __glutCreateMenuWithExit
    and a number of others.
    These errors are in the glut.h file.
    glut32.lib is set in a special directory and I specified the linkeer
    option -L(directory where glut32.lib is positioned)
    glut32.dll is in the windows\system directory. glut.dll is not in the
    install package.
    What can I do to reach the mentioned file.
    ldries46, Jan 24, 2011
    #1
    1. Advertising

  2. On Jan 24, 9:55 am, "ldries46" <> wrote:
    > I'm trying to understand how to program OpenGL in a Windows 7 environment..
    > Now I get the error message: Undefined reference to __glutCreateMenuWithExit
    > and a number of others.
    >

    You've got to fight windows linkers to some extent.
    I've found the easiest solution is to use the IDE and graphically drag
    and drop third party libraries into your project. However even then
    you might have to play with options until it works. You've also got to
    make sure you link as C rather than name-mangled C++.
    Malcolm McLean, Jan 24, 2011
    #2
    1. Advertising

  3. ldries46

    ldries46 Guest

    I'm using Gnat Programming Studio. In the .gpr file I gave For Linker
    Options use directory where glut32.lib is placed. but I still get the fault
    messages.
    In the project I use the outer layer is C++ en the inner layers are C so I
    expicitly tell the compiler to use the C compiler for .c files and the C++
    compiler for cpp files

    "Malcolm McLean" <> schreef in bericht
    news:...
    > On Jan 24, 9:55 am, "ldries46" <> wrote:
    >> I'm trying to understand how to program OpenGL in a Windows 7
    >> environment.
    >> Now I get the error message: Undefined reference to
    >> __glutCreateMenuWithExit
    >> and a number of others.
    >>

    > You've got to fight windows linkers to some extent.
    > I've found the easiest solution is to use the IDE and graphically drag
    > and drop third party libraries into your project. However even then
    > you might have to play with options until it works. You've also got to
    > make sure you link as C rather than name-mangled C++.
    ldries46, Jan 24, 2011
    #3
  4. ldries46

    ldries46 Guest

    I am using GPS. I have added the -L option as linker Option with the
    directory in which glut32.lib staat. Still the variable stay undefined.
    I do use the C compiler for the .c files and the C++ compiler for the cpp
    files.

    "Malcolm McLean" <> schreef in bericht
    news:...
    > On Jan 24, 9:55 am, "ldries46" <> wrote:
    >> I'm trying to understand how to program OpenGL in a Windows 7
    >> environment.
    >> Now I get the error message: Undefined reference to
    >> __glutCreateMenuWithExit
    >> and a number of others.
    >>

    > You've got to fight windows linkers to some extent.
    > I've found the easiest solution is to use the IDE and graphically drag
    > and drop third party libraries into your project. However even then
    > you might have to play with options until it works. You've also got to
    > make sure you link as C rather than name-mangled C++.
    ldries46, Jan 24, 2011
    #4
  5. On 2011-01-24, ldries46 <> wrote:
    > I am using GPS. I have added the -L option as linker Option with the
    > directory in which glut32.lib staat. Still the variable stay undefined.
    > I do use the C compiler for the .c files and the C++ compiler for the cpp
    > files.


    Have you actually specified to link with glut32? I'm not familiar
    with Gnat but if it's anything like a traditional Unix compiler
    there are two "L" options of significance. The "-l" option
    (lowercase) actually specifies to include a library, i.e. -lglut32.
    The "-L" option adds a directory to the library search path which
    it will consult when trying to find glut32. However, if it is not
    requested in the first place simply adding the correct directory
    to the search path will not accomplish anything.

    --
    Andrew Smallshaw
    Andrew Smallshaw, Jan 24, 2011
    #5
  6. ldries46

    ldries46 Guest

    At first I used the -L option and latet the -l option with both I still have
    the same problem.

    "Andrew Smallshaw" <> schreef in bericht
    news:...
    > On 2011-01-24, ldries46 <> wrote:
    >> I am using GPS. I have added the -L option as linker Option with the
    >> directory in which glut32.lib staat. Still the variable stay undefined.
    >> I do use the C compiler for the .c files and the C++ compiler for the cpp
    >> files.

    >
    > Have you actually specified to link with glut32? I'm not familiar
    > with Gnat but if it's anything like a traditional Unix compiler
    > there are two "L" options of significance. The "-l" option
    > (lowercase) actually specifies to include a library, i.e. -lglut32.
    > The "-L" option adds a directory to the library search path which
    > it will consult when trying to find glut32. However, if it is not
    > requested in the first place simply adding the correct directory
    > to the search path will not accomplish anything.
    >
    > --
    > Andrew Smallshaw
    >
    ldries46, Jan 25, 2011
    #6
  7. ldries46 wrote:
    > I'm trying to understand how to program OpenGL in a Windows 7 environment.
    > Now I get the error message: Undefined reference to
    > __glutCreateMenuWithExit and a number of others.
    > These errors are in the glut.h file.
    > glut32.lib is set in a special directory and I specified the linkeer
    > option -L(directory where glut32.lib is positioned)
    > glut32.dll is in the windows\system directory. glut.dll is not in the
    > install package.
    > What can I do to reach the mentioned file.


    You might be better off looking for a group which discusses whatever
    build tools you are using, or perhaps one which covers OpenGL. It sounds
    like your problem is in configuring your build tools, or possibly in
    some unusual build requirements of OpenGL. This group is mainly about
    the C programming language itself; you may be lucky and find someone
    here who happens to know the answer to this, but I expect there are
    other places with more expertise in these tools or libraries.

    If your build tools follow the old UNIX conventions, you probably need
    to make sure you have a -L giving the path to glut32.lib and also
    -lglut32 to specify the library to link against. Some tools require the
    '-L path' to be before the '-lglut32' on the command line.
    J. J. Farrell, Jan 25, 2011
    #7
  8. On 2011-01-25, ldries46 <> wrote:
    >
    > "Andrew Smallshaw" <> schreef in bericht
    > news:...
    >
    >> The "-L" option adds a directory to the library search path which
    >> it will consult when trying to find glut32. However, if it is not
    >> requested in the first place simply adding the correct directory
    >> to the search path will not accomplish anything.

    >
    > At first I used the -L option and latet the -l option with both I still have
    > the same problem.


    In all likelihood you'll need both since they are doing different
    jobs, and it certainly isn't as simple as substituting "l" for "L"
    since the parameters are different.

    Looking back at the error you are getting makes me even more sure
    this is your actual problem: an undefined reference error indicates
    the linker has found and processed all the files it has been
    instructed to link together, but when doing so it has noticed that
    the combined sum does not amount to a complete program - there are
    functions or variables referred to in the code that are not actually
    defined anywhere. That is a symptom of a missing library.

    If OTOH you had instructed the linker to include the correct library
    but it couldn't find it you'd be getting a file error instead - "I
    couldn't find this file to include".

    --
    Andrew Smallshaw
    Andrew Smallshaw, Jan 25, 2011
    #8
  9. On Mon, 24 Jan 2011 11:02:17 +0100, "ldries46"
    <> wrote:

    > I'm using Gnat Programming Studio. In the .gpr file I gave For Linker
    > Options use directory where glut32.lib is placed. but I still get the fault
    > messages.

    [namely 'undefined reference'(s)]

    > In the project I use the outer layer is C++ en the inner layers are C so I
    > expicitly tell the compiler to use the C compiler for .c files and the C++
    > compiler for cpp files
    >

    As already said, C (and C++) compilers and linkers commonly use
    separate options to specify the directories containing libraries and
    the actual library files, classically -L uppercase and -l lowercase.
    (Although this is not required and I have seen other ways.)

    GPS however is designed to cope with Ada which requires rather more
    complex handling of libraries, among other things. GNAT (the GCC
    implementation of Ada) bends this as close as it can to the practice
    for other compiled languages but it is still not identical. You need
    to ask people who know about GPS and possibly GNAT tools like
    gnatmake; I don't know if there is a specific forum for that, but I
    know there are users of GNAT and GPS on c.l.ada who can point you in
    the right direction -- even if your problem doesn't involve Ada.
    David Thompson, Jan 30, 2011
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Skinner

    OpenGL from JNI on MacOSX

    Andy Skinner, Jan 8, 2004, in forum: Java
    Replies:
    0
    Views:
    491
    Andy Skinner
    Jan 8, 2004
  2. nos

    openGL and 1.5

    nos, Mar 5, 2004, in forum: Java
    Replies:
    3
    Views:
    558
    Christophe Vanfleteren
    Mar 5, 2004
  3. Gene Davis

    Java Bindings for OpenGL

    Gene Davis, Jun 26, 2004, in forum: Java
    Replies:
    0
    Views:
    403
    Gene Davis
    Jun 26, 2004
  4. Gene Davis
    Replies:
    0
    Views:
    421
    Gene Davis
    Jul 5, 2004
  5. Steve
    Replies:
    5
    Views:
    1,407
    Phil Frisbie, Jr.
    Sep 29, 2003
Loading...

Share This Page