Sign in to follow this  
pyrosim

OpenGL and SDL Trouble

Recommended Posts

When I try to compile this code: ------------------------------------------------------------ #include <iostream> #include <string> #include <SDL/SDL.h> #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> #include <SDL/SDL_openGL.h> using namespace std; #include "defines.h" /* Define SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, amd APP_NAME*/ int main(int argc, char *argv[]) { if(SDL_Init(SDL_INIT_VIDEO)<0) { cerr<<"Error: SDL_Init\n"<<SDL_GetError()<<endl; return 1; } atexit(SDL_Quit); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); SDL_GL_SetAttribute(SDL_GL_RED_SIZE,5); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,6); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,5); if(SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,SDL_OPENGL)==NULL) { cerr<<"Error: SDL_SetVideoMode\n"<<SDL_GetError()<<endl; return 1; } SDL_WM_SetCaption(APP_NAME,NULL); // Put OpenGL rendering commands here (don't know them yet) SDL_GL_SwapBuffers(); SDL_Delay(3000); return 0; } ------------------------------------------------------------------------- In MS visual C++ 6, I get these errors: --------------------Configuration: main - Win32 Debug-------------------- Compiling... main.cpp Linking... main.obj : error LNK2001: unresolved external symbol _SDL_GL_SwapBuffers main.obj : error LNK2001: unresolved external symbol _SDL_GL_SetAttribute Debug/main.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. main.exe - 3 error(s), 0 warning(s) ------------------------------------------------------------------------- I have set up the linker configuration as: ------------------------------------------------------------------------- kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SDL.lib SDLmain.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/main.pdb" /debug /machine:I386 /nodefaultlib:"libcmt.lib" /out:"Debug/main.exe" /pdbtype:sept ------------------------------------------------------------------------- So I am including the SDL.lib and SDLmain.lib files and excluding the libcmt.lib file. I dont understand why it wont compile and can't find any reference on the web. Is there another library I need to add for the openGL commands? If anyone knows what is going on and can help please do.

Share this post


Link to post
Share on other sites
If i change to the multithreaded DLL my errors become:
--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol _SDL_GL_SwapBuffers
main.obj : error LNK2001: unresolved external symbol _SDL_GL_SetAttribute
SDLmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol __pctype
SDLmain.lib(SDL_main.obj) : error LNK2001: unresolved external symbol ___mb_cur_max
Debug/main.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

main.exe - 5 error(s), 0 warning(s)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this