Includes

Running OpenGL under Windows 7 pro and Visual Studio 6. I have included the following libraries in my “C” program:

<Windows.h>
<gl\gl.h>
<gl\glu.h>
<gl\glaux.h>
<Stdio.h>
<math.h>
I have run this program before with no problems. However, now I try to run and get Link errors:
LNK2001 missing ext symbol _glyPerspective@32
_Imp_glLoadIdentity@0
_Imp_glMatrixMode@4
and many more, total 256 unresolved external variables, not sure what is wrong. Do I need more include files or?

Sid Kraft

This is definitely a typo. The correct function is called gluPerspective.
WRT other functions, your project seems to be lacking opengl32.lib and glu32.lib in Project → Link → Object/Library modules.

Running opengl with win7 pro, compiled an opengl program, tried to build and it gives me unresolved external reference “_main”. The sample program was written by opengl so I would think it would “build” and “execute”, not sure why I am getting “main” as an unresolved external. I usually use Fortran, not “c++” so not familiar with the missing “main”, any ideas? Sid Kraft

Perhaps you should invest some time in programming in C++ without OpenGL, before pushing forward with OpenGL. Alternatively, you could find an OpenGL binding for Fortran. Though most such bindings are very out of date.

[QUOTE=Sidney;1266411]Running OpenGL under Windows 7 pro and Visual Studio 6. I have included the following libraries in my “C” program:
<Windows.h>
<gl\gl.h>
<gl\glu.h>
<gl\glaux.h>
<Stdio.h>
<math.h>
[/QUOTE]

  1. Those aren’t libraries, they’re headers. You still need to link against the appropriate libraries.

  2. The “aux” library is ancient history. Even if you can find a version which works on modern systems, don’t expect to find anyone who still remembers anything about it in the event that you need to ask for help. Convert the code to use GLUT (or GLFW, or something else reasonably modern).

While I agree with the sentiment of Alfonse’ response, the most common cause of that specific issue is telling the IDE that you’re building a “GUI application” (which expects a WinMain() function) rather than a “console application” (which expects a main() function).

Note that console applications can still use GUI features; the only real difference is that console applications use the standard main() entry point and have stdin/stdout/stderr set up, while GUI applications use the Windows-specific WinMain() entry point and don’t have the standard streams.

OK People, so I need more experience with C++, will do, but how do I get the “main” attribute attached to my program at this time so I can execute. Sid Kraft

Here’s one idea: if you’re going to ask a introductory general programming question on an OpenGL forum, you could at least stop making new threads for dealing with the same issue. You could also use Google to learn something about C++.

“main” is not an “attribute”; it’s the name of a function. As the name suggested, it’s the “main” function in C++. It’s what starts a program’s execution, and exiting the “main” function ends the program’s execution.

Sorry about the confusion on different threads, I am a first time user to this forum, don’t know how to use it yet. Sid Kraft

Note: That I have the identical code on my laptop computer and it runs fine without a “main” program, I ran that same thing on my desktop computer with all of the settings for the C++ compiler and the linker the same and the system gets an error that the unresolved variable “_main” is missing!! not sure what the problem is, any help would be appreciated. Both computers running Win 7 Pro! Sid Kraft