Jump to content
  • Advertisement
Sign in to follow this  
murdock

Using SFont with SDL

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

If you intended to correct an error in the post then please contact us.

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;

Font = SFont_InitFont(IMG_Load("24P_Copperplate_Blue.png"));


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

Share this post


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

Share this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by murdock
Now I'm getting unresolved externals


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

Share this post


Link to post
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 this post


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

If I add the sdl_image.lib to the additional options everything works

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

Share this post


Link to post
Share on other sites
Quote:
Original post by murdock
Is 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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!