• 14
• 12
• 9
• 10
• 13

# Using SFont with SDL

This topic is 4656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

error C3861: 'IMG_Load': identifier not found, even with argument-dependent lookup I'm getting the above error when I try to use the SFont library to load fonts. Anyone got any suggestions?

#include <stdio.h>
#include <stdlib.h>
#include "SFont.h"
#include "SDL.h"
#include "SDL_timer.h"

SFont_Font* Font;


If I try to add SDL_Image.h to the includes VS.NET complains...

##### Share on other sites
Do you actually have SDL_image installed?

##### Share on other sites
no, is there documentation for setting it up under VS.NET? All I can find are setups for Linux/Unix.

##### Share on other sites
You use it the same way you did with SDL. Actually all you have to do is copy the SDL_Image.lib to where your SDL.lib and SDLmain.lib are, copy the SDL_Image.h file to where your SDL.h file is, and finally copy all the .dlls to either your system32 folder or the current project's directory. When all that is done, all you need to do is #include "SDL_Image.h" and you are all set!

##### Share on other sites
So I can put the SDL DLL files under system32 as well?

##### Share on other sites
Now I'm getting unresolved externals

##### Share on other sites
Quote:
 Original post by murdockNow I'm getting unresolved externals

Did you link in SDL_Image.lib as you did with SDL.lib and SDLmain.lib?

##### Share on other sites
the SDL_Image.lib is in the same directory as the SDL.lib
SDL_image.h is in the same file as the other SDL_???.h files..

##### Share on other sites
ok if I go to project->properties then the linker tab and command line

Is there a way to make this change more permanent so I don't have to add this for every new project?

##### Share on other sites
Quote:
 Original post by murdockIs there a way to make this change more permanent so I don't have to add this for every new project?

Not really. Setting the project settings is a once per project thing. I mean you could probabally override the default program template or make your own so it is auto-linked, but that might be too much trouble.

Alternatively, you can simply link in Microsoft based compiler with the line:
#pragma comment ( lib, "SDL_Image.lib" )

So what you can do is open up your SDL.h header file and add this to the top:
#pragma comment ( lib, "SDLmain.lib" )
#pragma comment ( lib, "SDL.lib" )

In the SDL_Image.h file:
#pragma comment ( lib, "SDL_Image.lib" )

That way, those libraries are auto linked whenever you use the header files [wink] I've used methods such as those before in frameworks to "make life easier"™ Have fun!