Jump to content
  • Advertisement
Sign in to follow this  
xeronite

Mysterious SDL linker error

This topic is 3248 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

I am getting an undefined reference error when linking my SDL application. The exact error is: undefined reference to `_SDL_UpperBlit' with a reference to a line where I am calling SDL_BlitSurface. I am using CodeBlocks with gcc, and linking to SDL.dll, 1.2.13. I am not getting any other undefined reference errors, despite using several other SDL functions. I don't think there is an error in my library, as I've built several other applications with the same libraries and headers. Could anyone offer any advice as to what the problem might be?

Share this post


Link to post
Share on other sites
Advertisement
I'm running XP 32-bit, and I've previously built other applications with 1.2.13, but I went ahead and tried it. No luck, same problem.

Share this post


Link to post
Share on other sites
I believe SDL_Blitsurface is just a macro wrapper for SDL_Upperblit (yuk i hate macros). So that is why you're getting upperblit there. As to why it's not linking, no clue. Just make sure it's linking with SDL properly. the only reason you'd get undefined ref is if the SDL library isn't visible to the linker.

Share this post


Link to post
Share on other sites
If it was a problem actually linking a header, then the error would probably complain about SDL_BlitSurface rather than _SDL_UpperBlit, so I doubt this is the problem.

If your other SDL calls work then it's probably a problem with that particular SDL_BlitSurface call. Are you calling it with the correct number and types of arguments?

Share this post


Link to post
Share on other sites
Quote:
Original post by The Archon
If it was a problem actually linking a header, then the error would probably complain about SDL_BlitSurface rather than _SDL_UpperBlit, so I doubt this is the problem.

Careful there: you don't link a header, you include it. Linking is for libraries. That said, you are correct in saying that it would be looking for SDL_BlitSurface if SDL.h or whatever the relevant header wasn't being included. (You'd however get another more explicit error if SDL.h couldn't be found at all!)

Quote:
If your other SDL calls work then it's probably a problem with that particular SDL_BlitSurface call. Are you calling it with the correct number and types of arguments?

Note that the OP is getting a linker error - it's not even got to making a finished binary yet. If the invocation of the function was incorrect, they'd be receiving a compiler error instead.

That said, this thread is kinda old now - OP, have you figured it out yourself yet? :)

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!