Sign in to follow this  
Argo15

Some problems in VC++ 2008

Recommended Posts

main.obj : error LNK2019: unresolved external symbol _SDL_Quit referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_UpdateRect referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_UpperBlit referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_PollEvent referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_FreeSurface referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_DisplayFormat referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_LoadBMP_RW referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_SetVideoMode referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_WM_SetCaption referenced in function _SDL_main main.obj : error LNK2019: unresolved external symbol _SDL_Init referenced in function _SDL_main I know, i included my header files, but i think my problem is my dll. How do include it in vc+++ 2008?

Share this post


Link to post
Share on other sites
You can additional libraries by going to Project Properties/Linker/Input/Additional Dependencies. For SDL you should add SDLmain.lib and SDL.lib. Also make sure the directories for the libs is on your linker path.

Share this post


Link to post
Share on other sites
Remember that header files simply contain declarations. That is, declarations simply make the compiler aware of various functions and types that your code uses. They don’t actually have the code defined. When you include windows.h, for example, it doesn’t mean you include the windows source code!

The same applies to SDL. You compiled SDL as a library right? The includes allow the compiler to figure out how to work with all the SDL functions and what not. However, in the linking phase, you need the actual libraries of code.

In VC++, if you open the project properties, under linker settings, there should be something for additional library directories or the like. Point that to where you have the **import** library (the .lib file). That just tell the linker where to look. There should be another setting for additional libraries or libraries to link in. Type in the names of the import libraries (I think it is SDLmain.lib and SDL.lib).

Also remember that the SDL DLLs need to be present in the same directory as the program.

Share this post


Link to post
Share on other sites
Quote:
Original post by oler1s
Also remember that the SDL DLLs need to be present in the same directory as the program.


No they don't. The directory from which the application is loaded is the first directory searched for DLLs, but it isn't the only one. DLLs can be loaded from the current directory, the system directory, the Windows directory or any directory listed in the PATH environment variable.

Share this post


Link to post
Share on other sites
First off, if you're going to present a gross over-simplification in For Beginners, please clearly mark it as such. Secondly, the alternatives are not just the "same directory as the executable" and "system directories", there are other places you can put DLLs. For instance, on my machine, the directory "C:\bin" is on the PATH, and SDL directories are placed there.

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