473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

weird includes // glGenTextures

Hello
in en.h i've:
#include "player.h"

if i do now include in player.h another header file:
#include "sod.h"

i get errors in en.h:
en.h:54: error: syntax error before `*' token
that's at this line:
public:
CPlayer *player; //here now the above error

if i do it like that in player.h:
//#include "sod.h"

there's no error. WHY? This looks weird to me.
All header files begin like this:
#ifndef __PLAYER_H
#define __PLAYER_H
same for all header. So ifndef __EN_H etc.

secondly, I'll post this also in a OpenGL newsgroup:
This, under Windows generates a new texID each time
it gets called but not under Linux. WHY? My model doesn't
get drawed and i guess because of that.

glGenTextures(1, &this->texID);

THANKS and regards
Michael
Oct 12 '05 #1
4 1976
Michael Sgier wrote:
Hello
in en.h i've:
#include "player.h"

if i do now include in player.h another header file:
#include "sod.h"

i get errors in en.h:
en.h:54: error: syntax error before `*' token
that's at this line:
public:
CPlayer *player; //here now the above error

if i do it like that in player.h:
//#include "sod.h"

there's no error. WHY?
This is a bit too short to give you an appropriate answer. Maybe, something
in your header is wrong, like a missing semicolon or something, and that
produces an error later in the other file.
All header files begin like this:
#ifndef __PLAYER_H
#define __PLAYER_H
same for all header. So ifndef __EN_H etc.
Those identifiers are reserved, like all that contain two consecutive
underscores.
secondly, I'll post this also in a OpenGL newsgroup:
This, under Windows generates a new texID each time
it gets called but not under Linux. WHY? My model doesn't
get drawed and i guess because of that.
If your model isn't drawn, it probably doesn't have to do with the texure.
What makes you think so?
glGenTextures(1, &this->texID);


Did you check for errors after that call?

Oct 12 '05 #2
In article <43**********************@news.sunrise.ch>,
Michael Sgier <sg***@nospam.ch> wrote:
in en.h i've:
#include "player.h"

if i do now include in player.h another header file:
#include "sod.h"

i get errors in en.h:
en.h:54: error: syntax error before `*' token
that's at this line:
public:
CPlayer *player; //here now the above error

if i do it like that in player.h:
//#include "sod.h"

there's no error. WHY? This looks weird to me.


Suspect (1) missing semicolon right before the public; or
(b) you're compiling as C instead of C++. If neither is so,
try to get the code into the smallest sample possible to
post here and hopefully in the process you'll detect
the problem yourself, if not, we'll have a look.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 12 '05 #3
Hello again
so here's more code.
THANKS
Michael

player.h:

#ifndef __PLAYER_H
#define __PLAYER_H
//#include "ogro.h" // IF I INCLUDE ogro.h the error gets fired
#include "camera.h"
#include "object.h"
#include "terrain.h"
#include <typeinfo>
class CPlayer : public CObject

{
....
};

#endif


then the enemy.h:

#ifndef __ENEMY_H
#define __ENEMY_H
#include "entity.h"
#include "vector.h"
#include "player.h"
#include <typeinfo>

class CTerrain;

enum AIState_t
{
AI_UNCARING, // enemy is not scared and does not care
AI_SCARED, // enemy is scared and running away
AI_DEAD
};

class CEnemy : public CEntity
{
private:

protected:
int hitPoints; // hit points the enemy has left
float distFromPlayer; // distance this enemy is from player
float runSpeed; // speed of enemy when running
AIState_t aiState; // state of enemy thought

virtual void OnProcessAI() {}

void OnCollision(CObject *collisionObject)
{
// if this enemy collides with another enemy
if (typeid(*collisionObject) == typeid(CEnemy))
{
modelState = MODEL_IDLE;
velocity = CVector(0.0, 0.0, 0.0);
}
// if this enemy collides with the terrain (always)
else if (typeid(*collisionObject) == typeid(CTerrain))
{
position.y =
((CTerrain*)collisionObject)->GetHeight(position.x, position.z) + size;
}
else
{
}
}

public:
CPlayer *player; // HERE I GET THE ERROR IF I INCLUDE ogro.h in
player.h
....
};

#endif

and the ogro.h:

#ifndef __OGRO_H
#define __OGRO_H
#include "enemy.h"

class COgroEnemy : public CEnemy
{
....
};
#endif
Oct 13 '05 #4
> #include "player.h"

if i do now include in player.h another header file:
#include "sod.h"

i get errors in en.h:
en.h:54: error: syntax error before `*' token
that's at this line:
public:
CPlayer *player; //here now the above error

....

"Michael Sgier" <sg***@nospam.ch> wrote in message
news:43**********************@news.sunrise.ch... Hello again
so here's more code.
THANKS
Michael

player.h:

#ifndef __PLAYER_H
#define __PLAYER_H
//#include "ogro.h" // IF I INCLUDE ogro.h the error gets fired
#include "camera.h"
#include "object.h"
#include "terrain.h"
#include <typeinfo>
class CPlayer : public CObject

{
...
};

#endif


....

Simple. egro.h uses the CPlayer class, which isn't defined til AFTER ergo.h
is included.

At the top of ergo.h include the line:
class CPlayer;

and your problem should go away.
Oct 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rob Long | last post by:
Hey, I've written a custom HTML library using many PHP scripts as seperate files (just like I'd do a java project) and I'm having some problems where I'm including scripts in different...
5
by: toronto | last post by:
I'm stumped. I'm playing with a javascript that produces falling snowflakes on screen. I got the script from this author: http://thelocust.org/projects/snow2/ If I hotlink to the exploding flake...
0
by: Catherine Lynn Wood | last post by:
I have a page that I just developed using a combination of stylesheets and div layers. It uses a 'tab' style system placing four div layers in the same space with visibility 'hidden' and position...
82
by: nobody | last post by:
Howdy, Mike! mikecoxlinux@yahoo.com (Mike Cox) wrote in message news:<3d6111f1.0402271647.c20aea3@posting.google.com>... > I'm a C++ programmer, and have to use lisp because I want to use >...
2
by: WisTex | last post by:
I've come across a very weird problem. Virtual includes work on all my ASP pages on the entire website, including those in subdirectories, yet they won't work on a particular page I created, even...
13
by: guitarromantic | last post by:
Hey everyone. I'm editing some stuff I did last summer, trying to bugfix and improve stuff. One improvement (or an oversight of the original design) is adding dynamic <title> tags to my pages....
2
by: Chris | last post by:
In SQL 2005 I have a stored procedure as below: @sub_no smallint OUTPUT BEGIN BEGIN TRANSACTION INSERT...INTO
6
by: kwest | last post by:
I just setup a new server with PHP 5 and ran into a problem with includes. Everytime I call something like require_once './includes/test.inc' I get a permissions message like this: Warning:...
3
by: Dameon99 | last post by:
Hi.. Im experiencing a weird error I dont know how to fix. I have a scanner object and whenever I use nextInt, anything above 3 causes the program to crash saying and links me to this line of the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.