C Board  

Go Back   C Board > General Programming Boards > Game Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-15-2002, 06:25 PM   #1
Programming is fun, mkay?
 
Join Date: Oct 2001
Posts: 490
Angry "class" errors!

I'm getting really angry with this! I want to create a class for my OpenGL Pong game! When I do this:

class P
{
public:
void setp(GLfloat x, GLfloat y);

private:
GLfloat p1x;
GLfloat p1y;
}; P PDAT[2];

void P::setp(GLfloat x, GLfloat y)
{
p1x = x;
p1y = y;
}

PDAT[0].setp(0.0f, 0.0f);

When I do this, it returns:

33 w32p3d.cpp
syntax error before `.'

Why does it do this?
__________________
Website(s): http://www16.brinkster.com/trifaze/

E-mail: trifaze_mattu@lycos.com

---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
SyntaxBubble is offline   Reply With Quote
Old 03-17-2002, 04:21 PM   #2
Registered User
 
Join Date: Aug 2001
Posts: 14
You cannot call a function from a global position in your code.

Put

PDAT[0].setp(0.0f, 0.0f);

inside main() or some other function and it will most likely work.
Laos is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ten Errors AverageSoftware Contests Board 0 07-20-2007 10:50 AM
Unknown Errors in simple program neandrake C++ Programming 16 04-06-2004 02:57 PM
Stupid compiler errors ChrisEacrett C++ Programming 9 11-30-2003 05:44 PM
Help me with these errors... :-( major_small C++ Programming 6 09-07-2003 08:18 PM
errors in class(urgent) ayesha C++ Programming 2 11-10-2001 06:51 PM


All times are GMT -6. The time now is 04:12 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22