pb de compilation sous linux
Bonjour,
voila sa me met sa quand je compile avec cette commande :
prsieux@debian:~/c++/infovideo$ g++ -c `sdl-config --cflags` sprite.cpp
sprite.cpp:8: error: expected unqualified-id before ‘using’
sprite.cpp: In constructor ‘sprite::sprite(int, char*)’:
sprite.cpp:17: error: ‘runtime_error’ was not declared in this scope
sprite.cpp:24: error: ‘runtime_error’ was not declared in this scope
voila les sources
sprite.cpp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include <cstdio>
#include <cstdlib>
#include <iostream>
#include "SDL_image.h"
#include "sprite.h"
using namespace std;
sprite::sprite(int trans, char* url)
{
SDL_Surface* temp;
SDL_RWops* png_img;
png_img = SDL_RWFromFile(url, "rb");
if(!png_img)
throw runtime_error( SDL_GetError() );
temp = IMG_LoadPNG_RW(png_img);
if(!temp)
throw runtime_error( SDL_GetError() );
chip = SDL_DisplayFormat(temp);
SDL_SetAlpha(chip, SDL_SRCALPHA | SDL_RLEACCEL, trans);
SDL_FreeSurface(temp);
} |
sprite.h
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #ifndef _SPRITE_
#define _SPRITE_
#include "SDL.h"
class sprite
{
public:
sprite(int trans, char* url);
SDL_Surface* chip;
SDL_Rect dst, src;
int px, py, x, y;
}
#endif |
Merci de bien vouloir m'aider.