unresolved external symbol even though i think i am linking correctly (MSVC)

c++, dynamic-linking, linker, sdl, visual-studio-2010

Solution

Possible reasons:

- the sdl.lib and sdlmain.lib settings are not added to dependency list

- their location was not added to the list of directories where the linker looks

- you have mismatched 32 and 64 bit versions of the libraries.

Problem

i have a project that is using SDL as an external library. The project uses functions such as _SDL_WM_SetCaption, _SDL_FillRect or _SDL_MapRGBA. I have told the linker to include the two libraries SDL.lib and SDLmain.lib and have told it to look in the folder where these libraries are placed. I have also inspected the library files with dumpbin.exe and the functions are there. however, it still doesnt work compiling/linking? why? anyone have any ideas? edit: here is an example output of the linker/compiler error: ``` 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function "public: void __thiscall SDLGLEngine::SetTitle(char *)" (?SetTitle@SDLGLEngine@@QAEXPAD@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_FillRect referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_MapRGBA referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_GL_SetAttribute referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_Quit referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) 14>libtestd.lib(sdlgl.obj) : error LNK2019: unresolved external symbol _SDL_Init referenced in function "public: bool __thiscall SDLGLEngine::Init(int,int,int,bool)" (?Init@SDLGLEngine@@QAE_NHHH_N@Z) ```

Original source