| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Wed Aug 30, 2006 6:30 pm Post subject: Problems with classes |
|
|
Hi folks,
First of all, i know i should only post psp programming specific questions, but i have this simple programming problem of which i can't find anything on the net and i tried looking on this forum and could only find this: http://forums.ps2dev.org/viewtopic.php?t=4956&highlight=classes but that did not work.
I want to use classes in my game but i get these errors:
syntax error before 'Level'
syntax error before '{' token
syntax error before ':' token
here is my Level.cpp code:
| Code: | void Level::Render()
{
// render code
}
void Level::Translate()
{
//translate code
}
|
and here is my Level.h code:
| Code: | class Level{
public:
void Render();
void Translate();
private:
int x,y
};
|
and i use the -lstdc++ as a parameter for the LIBS = in the makefile.
| Code: | TARGET = out
OBJS = $(wildcard *.c)
INCDIR =
CFLAGS = -O2 -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -g
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -lstdc++ -g -lpspgu -lpng -lz -lm -lpsputility -lpsprtc -lmad -lpspaudiolib -lpspaudio -lpsppower -lmikmod
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak |
what am i doing wrong?
greets ghoti
PS i use Visual C++[/code] _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
Aion
Joined: 24 Jul 2006 Posts: 40 Location: Montreal
|
Posted: Wed Aug 30, 2006 10:35 pm Post subject: |
|
|
Is your file extension still "xxx.c"
When programming in C++, you need to use xxx.cc or xxx.cpp to tell the compiler this is not a C file.
Also, you only have a makefile rule for .c files, you need to add one for your xxx.cpp or xxx.cc (whichever name you choose) |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Fri Sep 08, 2006 3:50 pm Post subject: |
|
|
you must link --> -lstdc++ toward the end of
LIBS to link _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
popcornx
Joined: 14 Mar 2006 Posts: 6
|
Posted: Fri Sep 08, 2006 5:30 pm Post subject: |
|
|
did you forget to put a ; after int x,y ??? _________________ 23BDFFFCAFB1000423BD0004
"nothing is impossible, not if you could imagen it" |
|
| Back to top |
|
 |
|