nihil-00 posted on Jul 31 2004 at 11:38 AM said:
c++ is working here out of the box, with global classes.
cpp.cpp:
#include "gp32.h"
#include "cpp_prototypes.h"
//#include "cpp.h"
using namespace std;
class basis {
private:
int wert;
public:
basis() {}
basis(int wert) {this->wert=wert;}
int get_private() { return wert;}
};
int calling_cpp() {
basis *donald = new basis(100);
int i = donald->get_private();
delete donald;
return i;
//works also:
//basis pluto(200);
//return pluto.get_private();
}
main.cpp:
#include "gp32.h"
#include "cpp_prototypes.h"
//#include "cpp.h"
u16 *framebuffer;
int calling_cpp();
int main() {
int x;
framebuffer = (u16*) FRAMEBUFFER1;
gp_setCpuspeed(33);
gp_initFramebuffer((u32)framebuffer,16,85);
gp_clearFramebuffer16(framebuffer,0xffff);
gp_drawString(30,30,22,"Starting c++ Programm ",0xf800,framebuffer);
x=calling_cpp();
if (x==100)
gp_drawString(30,50,22,"Ending c++ Programm ",0xf800,framebuffer);
while (1) { if ( gp_getButton()&BUTTON_A) gp_Reset(); }
}
COMPILING:
arm-elf-c++ -I../lib.src/include -O2 -s -w -mtune=arm9tdmi -c -o main.o main.cpp
arm-elf-c++ -I../lib.src/include -O2 -s -w -mtune=arm9tdmi -c -o cpp.o cpp.cpp
arm-elf-gcc -c -o crt0.o crt0.S
arm-elf-g++ -nostartfiles -s -Wall -Wl,-Map,Test.map -T lnkscript crt0.o -o cpp.elf main.o cpp.o -L../lib -lmirkoSDK
arm-elf-objcopy -O binary cpp.elf cpp.bin
b2fxec -a Mirko_Roller -t SDK_EXAMPLE_cpp cpp.bin cpp.fxe
iam using spiivvys crt0,S in the help dir, the other one works also too ...