| View previous topic :: View next topic |
| Author |
Message |
x2cube
Joined: 11 Oct 2005 Posts: 7
|
Posted: Sun Oct 16, 2005 6:16 am Post subject: using namespace or class? |
|
|
How do I put a namespace or class in my project?
I tried this:
| Code: |
namespace ABC
{
class PSPabc
{
int i;
};
}
|
but some errors arose:
| Code: |
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c
In file included from main.c:20:
main.h:1: error: syntax error before 'ABC'
main.h:2: error: syntax error before '{' token
make: *** [main.o] Error 1
|
what should I do? |
|
| Back to top |
|
 |
CyberBill
Joined: 26 Jul 2005 Posts: 86 Location: Redmond, WA
|
Posted: Sun Oct 16, 2005 6:44 am Post subject: |
|
|
Dont use .c, use .cpp.
You probably need to change some stuff in your makefile to allow for C++ code, too.
But that is the correct syntax. |
|
| Back to top |
|
 |
x2cube
Joined: 11 Oct 2005 Posts: 7
|
Posted: Sun Oct 16, 2005 6:52 am Post subject: |
|
|
| CyberBill wrote: | Dont use .c, use .cpp.
You probably need to change some stuff in your makefile to allow for C++ code, too.
But that is the correct syntax. |
thanks for the help! |
|
| Back to top |
|
 |
Paco
Joined: 09 Oct 2005 Posts: 54
|
Posted: Sun Oct 16, 2005 8:20 am Post subject: |
|
|
| CyberBill wrote: | | You probably need to change some stuff in your makefile to allow for C++ code, too. |
At worst a LIBS = -lstdc++, probably needed for STL, new / delete and abstract methods. _________________ Paco |
|
| Back to top |
|
 |
|