| View previous topic :: View next topic |
| Author |
Message |
cp25stack
Joined: 16 Dec 2006 Posts: 11
|
Posted: Mon Jan 22, 2007 3:27 pm Post subject: Ehh? Can the toolchain compile C++? |
|
|
I try to use some C++ feature such as "new" or "Class",
but the source code cannot be compiled?
In case of "new" it said error: 'new' undeclared ,first use...
As i understand the gcc can compile both c and c++ isn'it?
Or do i need to use some flag of compilation?
my current make file is..
===========================================
TARGET = MyDemo
OBJS = main.o graphics.o framebuffer.o game.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
===========================================
(copy from the tutorial.)
And if it use some additional flag to compile C++,
will the result file can run on psp machine normaly?
thanks |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Mon Jan 22, 2007 5:06 pm Post subject: |
|
|
| Use g++ for C++ programs. You'll also need to link with g++. Note that the default build.mak with the pspsdk uses $(LINK.c) to link the elf, so you'll have to write your own linker rule or redefine LINK.c=$(LINK.cc). |
|
| Back to top |
|
 |
cp25stack
Joined: 16 Dec 2006 Posts: 11
|
Posted: Mon Jan 22, 2007 11:15 pm Post subject: |
|
|
| thanks, at this state i can clear this problem, using makefile from GU tutorial. it can compile c++ code but i still not sure about the Link.cc as you said (i still not test the result, because it is a littlebit difficult for me to use the computer :P) |
|
| Back to top |
|
 |
|