including opengl library

Started by
8 comments, last by BloodLust666 18 years, 3 months ago
for some reason, it's not seeing that i'm including the <gl/gl.h> files and whatnot... i get an error for every gl command i use. am i missing something?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
If you're getting errors like these
1>Linking...1>vis_console.obj : error LNK2001: unresolved external symbol __imp__glEnd@01>vis_console.obj : error LNK2001: unresolved external symbol __imp__glBegin@41>D:/Apps/foobar2000_0.8.3/own/foo_vis_console.dll : fatal error LNK1120: 2 unresolved externals
then you are not linking your application against the opengl32.lib library. The way to do that depends on which IDE you are using.

To make it is hell. To fail is divine.

If you are on a case sensitive platform you might need to include <GL/gl.h> (instead of <gl/gl.h>)

However, if you're on Windows you don't have to worry about it.
i'm getting errors like this:

D:\Program Files\Visual Studio .Net 2003\Vc7\PlatformSDK\Include\gl\GL.h(1152): error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
D:\Program Files\Visual Studio .Net 2003\Vc7\PlatformSDK\Include\gl\GL.h(1152): error C2146: syntax error : missing ';' before identifier 'glAccum'
D:\Program Files\Visual Studio .Net 2003\Vc7\PlatformSDK\Include\gl\GL.h(1152): error C2182: 'APIENTRY' : illegal use of type 'void'
D:\Program Files\Visual Studio .Net 2003\Vc7\PlatformSDK\Include\gl\GL.h(1153): error C2144: syntax error : 'void' should be preceded by ';'
D:\Program Files\Visual Studio .Net 2003\Vc7\PlatformSDK\Include\gl\GL.h(1153): error C2501: 'WINGDIAPI' : missing storage-class or type specifiers
...
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
did you put
#include <windows.h>
before including gl/gl.h ?
Seems your compiler is missing those definitions of basic window stuff.
hmm... well, how do i not need that stuff. b/c i'm trying to make my programs cross platform and i switched to opengl so i don't need windows stuff.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
OpenGL doesn't provide platform independence; it just happens to be platform independent itself. You'll need to use OpenGL with something like SDL or GLUT for full platform independence.
#ifdef _WIN32
#influde windows
#include gl.h
#endif

#ifndef _WIN32
#include gl.h

so your code stays platform independant
be sure you linked the "gl.lib" in the project dev evenvironment.
I get the exact same errors when I forget.
i am using SDL for that. i'm going to try to do what Eitsch said, see if that works..
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement