所以这就是我遇到的问题。突然之间,实施SDL在vs 2013上不再起作用了。更具体地说,随时都包含SDL标准头我得到链接器错误。我尝试使用以下代码构建我的项目:
#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;
}
我收到以下错误:
错误1错误LNK2019:未解析的外部符号_SDL_CreateWindow在函数_SDL_main中引用C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误2错误LNK2019:函数_SDL_main中引用的未解析的外部符号_SDL_DestroyWindow C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误3错误LNK2019:函数_SDL_main中引用的未解析的外部符号_SDL_GL_SetAttribute C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误4错误LNK2019:函数_SDL_main中引用的未解析的外部符号_SDL_GL_CreateContext C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误5错误LNK2019:函数_SDL_main中引用的未解析的外部符号_SDL_GL_DeleteContext C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误6错误LNK2019:函数_SDL_main中引用的未解析的外部符号_SDL_Delay C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误7错误LNK2019:未解析的外部符号_SDL_Init在函数_SDL_main中引用C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ main.obj
错误8错误LNK2019:函数___tmainCRTStartup中引用了未解析的外部符号_main C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Open GL \ MSVCRTD.lib(crtexe.obj)
错误9错误LNK1120:8个未解析的外部C:\ Users \ Nas \ Documents \ Visual Studio 2013 \ Projects \ Open GL \ Debug \ Open GL.exe
感谢任何帮助:)
这是我已经尝试的一系列事项: