Results 1 to 10 of 10

Thread: Includes

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    21

    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

  2. #2
    Member Newbie
    Join Date
    May 2015
    Posts
    37
    Quote Originally Posted by Sidney View Post
    glyPerspective
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    21

    Includes2

    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

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675
    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.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,105
    Quote Originally Posted by Sidney View Post
    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>
    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).

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,105
    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.

  7. #7
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    21

    Includes3

    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

  8. #8
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675
    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.

  9. #9
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    21
    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

  10. #10
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    21
    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

Similar Threads

  1. includes
    By brooks.brian in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-26-2006, 06:12 AM
  2. Includes incomplete?
    By in forum OpenGL: Linux
    Replies: 4
    Last Post: 12-12-2003, 04:54 PM
  3. OpenGL 1.3 includes for download
    By marcus256 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-15-2002, 07:53 AM
  4. help with libs and includes
    By Death_Claw in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-19-2001, 03:04 PM
  5. includes GL*.h
    By alanchinese in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-14-2000, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean