Skip to main content
GameDev.net gamedev.net
🔒 Locked

Cross-platform Extensions (porting from Linux -> Windows)

Started by Synival Aug 11, 2012 at 10:49 PM 1 replies 1.7k views
Original Post
Synival
Synival

I'm finally porting my game from Linux to Windows, and nothing from glext.h seems to be working. Under MinGW, I'm getting undefined references for just about everything:
[source lang="plain"]game/assets.c:178: error: ‘GL_VERTEX_SHADER’ undeclared (first use in this function)
game/assets.c:178: error: (Each undeclared identifier is reported only once
game/assets.c:178: error: for each function it appears in.)
game/assets.c:182: error: ‘GL_FRAGMENT_SHADER’ undeclared (first use in this function)[/source]
I'm using the following #includes:
[source lang="plain"]#ifdef _WIN32
#include "../win/dirent.h"
#else
#include
#endif
#include
#include
#include
#include
#include

#include
#include [/source]
...and here is the source code in question:
[source lang="plain"]...
/* load shaders. */
else if (strcasecmp (ext, "vert") == 0) {
if (shader_load (name, file, GL_VERTEX_SHADER))
return "";
}
else if (strcasecmp (ext, "frag") == 0) {
if (shader_load (name, file, GL_FRAGMENT_SHADER))
return "";
}[/source]
I've tried manually defining everything used from glext.h which, although it seems dangerous, does compile successfully, but doesn't link properly:

[source lang="plain"]game/maps.wo:maps.c:(.text+0x4711): undefined reference to _glCreateProgram'
game/maps.wo:maps.c:(.text+0x472c): undefined reference to
_glAttachShader'
game/maps.wo:maps.c:(.text+0x476d): undefined reference to _glAttachShader'
game/maps.wo:maps.c:(.text+0x477b): undefined reference to
_glLinkProgram'
game/maps.wo:maps.c:(.text+0x4789): undefined reference to _glUseProgram'
game/maps.wo:maps.c:(.text+0x479c): undefined reference to
_glGetUniformLocation'
game/maps.wo:maps.c:(.text+0x47bc): undefined reference to _glUniform1fv'
game/maps.wo:maps.c:(.text+0x47cf): undefined reference to
_glGetUniformLocation'
game/maps.wo:maps.c:(.text+0x4805): undefined reference to _glUniform1fv'
game/maps.wo:maps.c:(.text+0x4818): undefined reference to
_glGetUniformLocation'
game/maps.wo:maps.c:(.text+0x4882): undefined reference to _glUniform4fv'
game/maps.wo:maps.c:(.text+0x4895): undefined reference to
_glGetUniformLocation'
...[/source]
...and so on. All of the normal gl.h functions (glVertex3f, etc) link properly.

Everything in the game is written in C, not C++, but that shouldn't be a problem. From what I've read, it looks like I need to link to drivers provided by the video card, but if that's the case, I'd need to make a separate build for every graphics card? Please, please, please, tell me that's not the case sad.png

-- Synival
L. Spiro
L. Spiro
There is a forum for all things OpenGL.

Windows® does not export functions beyond OpenGL 1.2 or so, and any functions in later versions need to be linked dynamically via wlgGetProcAddress().


L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid
Synival
Synival
Whoops, I'll repost this in that board. Thanks.

Edit: Blast, I guess I can't delete this thread. Either way, I've reposted this in its proper place:
http://www.gamedev.net/topic/629472-cross-platform-extensions-porting-from-linux-windows/
-- Synival

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.