Jump to content
  • Advertisement
Sign in to follow this  
mounty0

using SDL - but cant recognise opengl

This topic is 4337 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've setup SDL under Visual Studio 03 to use with OpenGL, and I can include the SDL.h and SDL_opengl.h headers alright, but when I try to run OpenGL commands the compiler doesnt recognise them and gives the 'unresolved external symbol' error, and I cant really figure out why. I setup SDL by: Copied SDL.lib and SDLmain.lib to Microsoft Visual Studio .NET 2003\Vc7\lib Copied the SDL .h files in the zip's include folder to Microsoft Visual Studio .NET 2003\Vc7\Include\SDL Copied SDL.dll to Windows\System32 Set the Project Properties --> Cplusplus --> Code Generation --> Runtime Library to: Multi-threaded DLL Set the Project Properties --> Linker --> Input --> Additional Dependencies to: SDL.lib SDLmain.lib I can compile this code ok:
#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"

int main(int argc, char* args[]) 
{
    SDL_Init(SDL_INIT_EVERYTHING);	
    SDL_Quit();
	
    return 0; 
}


But when I try to include an OpenGL command I get the 'unresolved external symbol' error:
#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"

void initOpenGL()
{
    glClearColor(0,0,0,0);
}

int main(int argc, char* args[]) 
{
    SDL_Init(SDL_INIT_EVERYTHING); 	
    SDL_Quit();

    return 0; 
}


Would anyone have any ideas what might be the problem, as none of the guides I read mentioned anything additional being required to get SDL_opengl up and running. Thanks all

Share this post


Link to post
Share on other sites
Advertisement
Firstly SDL_Init(SDL_INIT_EVERYTHING) doesnt actually set up OpenGL, to do that oyu need to set a screen mode using:
SDL_SetVideoMode(width, height, bpp, SDL_OPENGL);

And also SDL.lib doesnt include the openGL lib. You will need to link openGL too, usually its called opengl32.lib (if not you may have to google for its name).

Share this post


Link to post
Share on other sites
ahh ok I see, I stuck opengl32.lib into 'Additional Dependencies' with the other libraries and it compiles now, thanks much ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!