Advertisement Jump to content
Sign in to follow this  

Compiling libraries

This topic is 3996 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 have some trouble compiling libraries. I needed to compile SDL_rotozoom and SDL_primitives, and I did (in Code::Blocks), but I always get a strange answer from the compiler when I compile. I have a piece of code that loads the image to the surface : p1[0].img = IMG_Load("gfx/body.png"); This used to work well, but when I compiled the SDL_rotozoom and SDL_primitives, and tried to use them in my project (aalineRGBA(screen,0,0,500,500,255,255,0,128); is the actual code I tried to use) compiler said "assignment makes a pointer from integer without cast" and refuses to compile. When I remove the aalineRGBA from the code, it compiles well... Any ideas what may cause this? I would appreciate if someone could explain exactly how to compile and use those libraries... I'm using Code::Blocks with minGW under Windows. Thank you in advance.

Share this post

Link to post
Share on other sites
Without more context or some compiler output it's very difficult to say for sure, but it looks like you might be passing the wrong parameters (is screen a pointer?) or possibly unintentionally calling a function with the same name in a different namespace. Either way more information would be very helpful in discovering what your problem is.

Share this post

Link to post
Share on other sites
Well, ok info coming right up :
I'm using pure C, so no name spaces
All surface variables are actually pointers to surfaces
It all works fine untill I call a function (any function) from SDL_gfx. I'm using SDL_ttf and SDL_images.h and have no problems.

The problem is (maybe)that I couldn't find precompiled binaries for SDL_gfx, so I was forced to do this by myself. I did so with Code::Blocks.

Here are the includes I used :
#include <stdio.h>
#include <stdlib.h>
#include <main.h>
#include <stdbool.h>
#include <SDL/SDL.h>
#include <SDL/SDL_gfxPrimitives.h>
#include <SDL/SDL_gfxPrimitives_font.h>
#include <SDL/SDL_framerate.h>
#include <SDL/SDL_imageFilter.h>
#include <SDL/SDL_rotozoom.h>

If you want, I will post the whole source, but it's not really a nice thing to look at...

Share this post

Link to post
Share on other sites
It's a structure (typedef-ed) that contains the surface, and some other info. Here's how it looks like :

typedef struct
int pX;
int pY;
int Angle;
int BPart;
SDL_Surface *img;
} BodyPart;

BodyPart p1[3];

Sorry I didn't mention that earlier.

Share this post

Link to post
Share on other sites
No need to post the entire source, just the line that uses aalineRGBA and maybe a couple of lines of context around it in a source tag along with the complete compiler output would be extremely helpful to anyone trying to help you.

In the meantime I have one more thought for you: are you using the return value of the function at all? I'm assuming the function probably returns int, so it's possible that the error is occurring there.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!