compiling C++ in the toolchain.

Peter Nijs peter at familienijs.be
Tue Jan 13 18:11:55 CET 2009


Hi,

How can I lake the toolchain compile my code as C++ instead of C? Just 
compiling it like told in the wiki results in:

peter at leela:/usr/local/openmoko/source/labyrinth> make                                                                                                       
make  all-recursive                                                                                                                                          
make[1]: Entering directory `/usr/local/openmoko/source/labyrinth'                                                                                           
Making all in src                                                                                                                                            
make[2]: Entering directory `/usr/local/openmoko/source/labyrinth/src'                                                                                       
ccache arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t -std=gnu99 
-DHAVE_CONFIG_H -I. -I.. -I.. -DPKGDATADIR=\"/usr/share/labyrinth\" -
DTERMINAL_LOCALE_DIR=\""/usr/share/locale"\" -
DPIXMAPDIR=\""/usr/share/pixmaps/labirynth"\" -DDATADIR=\""/usr/share"\" -
D_GNU_SOURCE -isystem/usr/local/openmoko/arm/arm-angstrom-linux-
gnueabi/include -Wall -pedantic -std=c99 -D_GNU_SOURCE=1 -D_REENTRANT -
I/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/include/SDL   -
isystem/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/include -fexpensive-
optimizations -fomit-frame-pointer -frename-registers -Os -MT main.o -MD -MP -
MF .deps/main.Tpo -c -o main.o main.c                                                                                                                       
main.c:9: warning: data definition has no type or storage class                                                                                              
main.c:9: warning: type defaults to ‘int’ in declaration of ‘using’                                                                                          
main.c:9: error: ‘std’ undeclared here (not in a function)                                                                                                   
main.c:9: error: expected ‘,’ or ‘;’ before ‘:’ token                                                                                                        
main.c:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before 
‘filename’                                                                         
main.c: In function ‘load_image’:                                                                                                                            
main.c:13: warning: type of ‘filename’ defaults to ‘int’                                                                                                     
main.c:21: error: request for member ‘c_str’ in something not a structure or 
union                                                                           
make[2]: *** [main.o] Error 1                                                                                                                                
make[2]: Leaving directory `/usr/local/openmoko/source/labyrinth/src'                                                                                        
make[1]: *** [all-recursive] Error 1                                                                                                                         
make[1]: Leaving directory `/usr/local/openmoko/source/labyrinth'                                                                                            
make: *** [all] Error 2


Which makes me think it's trying to compile it as C instead of C++. I tried to 
rename the source file to main.cpp (and of cource change all references to 
it). Now:

peter at leela:/usr/local/openmoko/source/labyrinth> make
make  all-recursive
make[1]: Entering directory `/usr/local/openmoko/source/labyrinth'
Making all in src
make[2]: Entering directory `/usr/local/openmoko/source/labyrinth/src'
make[2]: *** No rule to make target `main.c', needed by `main.o'.  Stop.
make[2]: Leaving directory `/usr/local/openmoko/source/labyrinth/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/openmoko/source/labyrinth'
make: *** [all] Error 2

depeje



More information about the devel mailing list