The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
SDL
Simple Directmedia Layer Forums
Dev c++ / C++/ SDL_image/ linker problem ?
coderdrawerpainter
Joined: 24 May 2013
Posts: 2
Posted: Fri May 24, 2013 4:12 am
Hello all who read this.
I have some code framework.
I have linked the SDL main libary with no problem, How ever I cannot seem to link the SDL_image libary with dev c++ linker.
using linker flag: -lSDL_image
and all SDL_image .dlls are in the same directory as my dev c++ project along with the SDL main .dll.
and Dev c++ derectories are pointing to SDL image includes and libs/x86 folder. What I get when I run this bad boy is just a flicker of the program window and then it closes.
If your in the same boat as I am or have been all through this before please post.
Thanks.
(here is what i have and it all compiles fine)
Code:
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
int main( int argc, char* args[] )
{
bool running = true ;
//Define constant variables, such as screen dimensions, and bpp.
const int screen_width = 640;
const int screen_height = 480;
const int screen_bpp = 32;
// define condition if SDL fails to initialise
if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
{
running = false ;
}
// defined pointer too computer graphics card video RAM (hardware accelarated) for screen dimensions to be drawn
screen = SDL_SetVideoMode(screen_width, screen_height, screen_bpp, SDL_HWSURFACE) ;
// windows only (maybe not my android)
SDL_WM_SetCaption("Game", NULL) ;
// define condition if screen has not been passed set values
if(screen == NULL)
{
running = false ;
}
// modifies the alpha transparency of SDL_Surface images
SDL_SetAlpha(image,SDL_SRCALPHA,80) ;
// pointer to array that stores key presses each variable in the array will respon to a key
Uint8 *keystates = SDL_GetKeyState(NULL) ;
// iffantley refreshing and filling the screen with a black rectangle , then flips to bring to the front on z index
while(running)
{
// SDL listens to own SDL and user key events, if events do occur store at address memory location, quit if quit events occurs
SDL_PollEvent(&occur) ;
if(occur.type == SDL_QUIT)
{
running = false ;
}