i know this is an idiot question, How can i clear the scene to start a new level in my game?
![Embarassed :oops:](./images/smilies/icon_redface.gif)
![Embarassed :oops:](./images/smilies/icon_redface.gif)
Hey BeshrBeshr wrote:thx! but that's not what i ment
in c++, how can i set up the project so i can for example make a cpp file for each leve, i'm not a good c++ programmer, is there is any place for tutorials on this subject??
Code: Select all
Linking...
Game_initialize.obj : error LNK2005: "class irr::video::IVideoDriver * driver" (?driver@@3PAVIVideoDriver@video@irr@@A) already defined in Game.obj
Game_initialize.obj : error LNK2005: "class irr::newton::World * p_world" (?p_world@@3PAVWorld@newton@irr@@A) already defined in Game.obj
Game_initialize.obj : error LNK2005: "class irr::scene::ISceneManager * smgr" (?smgr@@3PAVISceneManager@scene@irr@@A) already defined in Game.obj
You might give Irrwizard a look. It will give you a basic framework to start off with.Beshr wrote: in c++, how can i set up the project so i can for example make a cpp file for each leve, i'm not a good c++ programmer, is there is any place for tutorials on this subject??
Code: Select all
#ifndef _h_file_
#define _h_file_
<...some code...>
#endif
what ? the variable are supposed to be defined in the .h along with the functions (unless you want to "hide" them), arn't they ?hybrid wrote:Don't define variables in .h files, but only in .cpp (and thus later on in .o) files. Because every inclusion of the .h file will create another instance of the variable, with the same name and scope.
Code: Select all
//File1.cpp
int x; //Global int x
//File2.cpp
int x; //global int x
//This produces that error, since there are 2 global "x"-objects
Code: Select all
//File1.cpp
int x; //Global int x
//File2.cpp
extern int x; //Global in x, which's object/memory is in another .cpp
Code: Select all
//file1.cpp
#include "File3.h"
int x;
//File 2.cpp
#include "File3.h"
//X was declared in file3.h
//File3.h
#ifndef _h_file_ //Protection!
#define _h_file_
extern int x;
#endif
They should be declared in .h files, but not defined. Even header protections won't help with definitions, as these will be put into each .o files which includes the .h file.eneru wrote:what ? the variable are supposed to be defined in the .h along with the functions (unless you want to "hide" them), arn't they ?hybrid wrote:Don't define variables in .h files, but only in .cpp (and thus later on in .o) files. Because every inclusion of the .h file will create another instance of the variable, with the same name and scope.