Using SDL on different cpp files

Hi, I dont know how i can set it to work
I have the main.cpp file, this is ok…in this file Im including:
#include “SDL/SDL.h”
#include “SDL/SDL_opengl.h”
#include

#pragma comment(lib, “SDL.lib”)
#pragma comment(lib, “SDLmain.lib”)
#pragma comment(lib, “opengl32.lib”)
#pragma comment(lib, “glu32.lib”)

//classes
includes:=================================================================================
#include “Player.h”
#include “Game.h”


It works ok.
On the Game class, I want handle the inputs, usind SDL_event…I tried
different combinations of including SDL to try make the Game to recognize
the SDL_event, but theres no way, how I do it?

//Game.cpp file:

#include “Player.h”//have to be before to find P1 and P2!
#include “Game.h”

#include

//Game.h file:
#pragma once

class Game{

private:
Player P1;
Player P2;

//Input variables:
SDL_event mevent;//handle SDL events

I can’t help you much as you seem to be using Visual Studio, and I
don’t know anything about what you might be doing wrong with that. I
would suggest, however, including your SDL version, compiler (maybe
I’m wrong about that, what do I know?) and the error messages produced
by your compiler (all of them; there’s probably something you’ve
overlooked.)

My guess is that the SDL headers are in fact not being included at
all. It looks like you only include them in main.cpp, and not in your
other files. The only other thing I notice related to that, however,
is that the correct way (at least according to age old SDL
documentation) to include the SDL headers is with this line:

#include “SDL.h”

Not this line:

#include <SDL/SDL.h>

I’m also not sure what #pragma once does, since that is compiler specific.

2009/3/24 Giuliano Pieta :> Hi, I dont know how i can set it to work

I have the main.cpp file, this is ok…in this file Im including:
#include “SDL/SDL.h”
#include “SDL/SDL_opengl.h”
#include

#pragma comment(lib, “SDL.lib”)
#pragma comment(lib, “SDLmain.lib”)
#pragma comment(lib, “opengl32.lib”)
#pragma comment(lib, “glu32.lib”)

//classes
includes:=================================================================================
#include “Player.h”
#include “Game.h”


It works ok.
On the Game class, I want handle the inputs, usind SDL_event…I tried
different combinations of including SDL to try make the Game to recognize
the SDL_event, but theres no way, how I do it?

//Game.cpp file:

#include “Player.h”//have to be before to find P1 and P2!
#include “Game.h”

#include

//Game.h file:
#pragma once

class Game{

private:
??? Player P1;
??? Player P2;

??? //Input variables:
??? SDL_event mevent;//handle SDL events


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/

I’m also not sure what #pragma once does, since that is compiler specific.

Its an alternative to header guards. Supposed to be better in ways.

----- Original Message -----
From: donny.viszneki@gmail.com (Donny Viszneki)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Tuesday, March 24, 2009 7:37:08 PM
Subject: Re: [SDL] Using SDL on different cpp files