so here's the problem I'm having. All of a sudden, implementing SDL just doesn't work anymore on vs 2013. To be more specific, anytime include the SDL standard header I get linker errors. I tried building my project with the following code:
#include <iostream>
#include <SDL.h>
SDL_Window *window;
SDL_GLContext context;
int main(int argc, char *argv[]){
std::cout << "hello world" << std::endl;
if (SDL_Init(SDL_INIT_EVERYTHING)){
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
window = SDL_CreateWindow("test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_OPENGL&SDL_WINDOW_SHOWN);
context = SDL_GL_CreateContext(window);
}
SDL_Delay(20000);
SDL_GL_DeleteContext(context);
SDL_DestroyWindow(window);
system("pause");
return 0;
}
I get the following errors:
Error 1 error LNK2019: unresolved external symbol _SDL_CreateWindow referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 2 error LNK2019: unresolved external symbol _SDL_DestroyWindow referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 3 error LNK2019: unresolved external symbol _SDL_GL_SetAttribute referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 4 error LNK2019: unresolved external symbol _SDL_GL_CreateContext referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 5 error LNK2019: unresolved external symbol _SDL_GL_DeleteContext referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 6 error LNK2019: unresolved external symbol _SDL_Delay referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 7 error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\main.obj
Error 8 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Open GL\MSVCRTD.lib(crtexe.obj)
Error 9 error LNK1120: 8 unresolved externals C:\Users\Nas\Documents\Visual Studio 2013\Projects\Open GL\Debug\Open GL.exe
any help is appreciated :)
here's a list of things I already tried:
- undefining main ~> #undef main
- changing my subsystem to both windows and console (neither worked)
- Repeatedly cleaning and rebuilding my project.