Page 1 of 1

can't use STL in Codewarrior

PostPosted: Nov 9, 2004 @ 8:22am
by v0101
I want to use STL strings in Codewarrior for Palm OS with GapiDraw, but I can't get my project to compile. To make sure nothing in my project was causing the problem, I opened up simple.mcp from the palm samples and added this line to myapplication.cpp.
#include <string>

Below are the errors I got when I tried to compile. I'm using GapiDraw 3.5 Beta 3. If I create a project that doesn't use GapiDraw in Codewarrior, I can use std::string without any problems.



Error : macro 'stdin' redefined
(included from:
cstdio:26
string:354
myapplication.cpp:5)
file_struc.h line 185 (&__std(__files[0])) /*- mm 961031 -*/ /*- mm 961203 -*/ /*- mm 000201 -*/

Error : macro 'stdout' redefined
(included from:
cstdio:26
string:354
myapplication.cpp:5)
file_struc.h line 186 (&__std(__files[1])) /*- mm 961031 -*/ /*- mm 961203 -*/ /*- mm 000201 -*/

Error : macro 'stderr' redefined
(included from:
cstdio:26
string:354
myapplication.cpp:5)
file_struc.h line 187 (&__std(__files[2])) /*- mm 961031 -*/ /*- mm 961203 -*/ /*- mm 000201 -*/

Error : declaration syntax error
(included from:
string:354
myapplication.cpp:5)
cstdio line 57 StrVPrintF(char * s,(const Char *)const char * format,va_list arg)

Error : illegal use of 'inline'
(included from:
string:354
myapplication.cpp:5)
cstdio line 124 Siofgetc( (& ::std::__files[0]))

Error : data type is incomplete
(included from:
string:354
myapplication.cpp:5)
cstdio line 125 { return getc(stdin); }

Error : declaration syntax error
(included from:
string:354
myapplication.cpp:5)
cstdio line 127 Siofputc(int c, (& ::std::__files[1]))

Error : expression syntax error
(included from:
string:354
myapplication.cpp:5)
cstdio line 131 { return file->state.eof; }

Error : expression syntax error
(included from:
string:354
myapplication.cpp:5)
cstdio line 134 { return file->state.error; }

Error : declaration syntax error
(included from:
string:354
myapplication.cpp:5)
cstdio line 170 }

PostPosted: Nov 9, 2004 @ 8:33am
by Johan
GapiDraw 3.5 beta3 contained the old Palm code and had some issues. Please download the latest RC1 - most of the Palm native code has been completely rewritten.

PostPosted: Nov 9, 2004 @ 9:17am
by v0101
Ok, it compiles now when I add #include <string> to the minimal example for Palm OS 5, but when I add these lines in ProcessNextFrame,


std::string my_string;
my_string = "My String";


I get this error in the emulator when I launch the program. I'm using the Palm Tungsten C Simulator.
I:\Ripple\ARM\Core\Emul68K\Src\Error68K.c, Line:1543, Write to WindowType (id 65535) off: 20, size: 4


By the way, no message comes up on the splash screen anymore. It's just an empty box.

PostPosted: Nov 9, 2004 @ 12:48pm
by Mikael

PostPosted: Nov 9, 2004 @ 10:37pm
by v0101

PostPosted: Nov 12, 2004 @ 6:01am
by v0101
Ok, ran into a problem with the changes you suggested. I tested this with my project as well as all the samples for Palm OS 5 and I get the same error everytime. Everything runs fine, but when I exit the program I get this error.
MemoryMgr.c, Line:3675, Invalid chunk ptr

By the way, I'm testing this out on the Tungsten C Simulator.