OpenGL with Windows 7


L

ldries46

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.
 
Ad

Advertisements

M

Malcolm McLean

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++.
 
L

ldries46

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
 
L

ldries46

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.
 
A

Andrew Smallshaw

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.
 
L

ldries46

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

Advertisements

J

J. J. Farrell

ldries46 said:
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.
 
A

Andrew Smallshaw

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".
 
Ad

Advertisements

D

David Thompson

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top