GP32 C++ Problems With Mr. Mirkos' Sdk?


unit3

Member
Joined
Aug 8, 2003
Messages
151
Location
Canada
Website
demoni.ca
Hey all,

Just having a little weirdness now that I'm trying to make some classes to use with Mr.Mirkos' SDK. My main header file contains the following lines:

#include "gp32.h"
#include "fileio.h"
#include "cpp_prototypes.h"
#include <string>
using namespace std;

However, when I attempt to compile my first class, I get the following result:

arm-elf-c++ -I/opt/gp32-arm-elf/include -Os -s -w -mtune=arm9tdmi -c -o game_layers.o game_layers.cpp
In file included from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/cstring:49,
from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/bits/char_traits.h:45,
from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/string:47,
from gamelib.h:11,
from game_layers.cpp:5:
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/cstddef:53: error: expected unqualified-id before "int"
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/cstddef:53: error: expected `;' before "int"
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/cstddef:53: error: declaration does not declare anything
In file included from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/bits/stl_algobase.h:69,
from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/bits/char_traits.h:46,
from /opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/string:47,
from gamelib.h:11,
from game_layers.cpp:5:
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:82: error: declaration of `operator new' as non-function
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:82: error: expected unqualified-id before "int"
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:82: error: expected `,' or `;' before "throw"
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:83: error: declaration of `operator new []' as non-function
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:83: error: expected unqualified-id before "int"
/opt/gp32-arm-elf/lib/gcc/arm-elf/3.4.1/../../../../include/c++/3.4.1/new:83: error: expected `,' or `;' before "throw"


There's actually about 4 more pages of similar stuff that gets printed. Now, I'm assuming that my C++ is rusty, and I haven't included things the way I should have. So, what's the "right" way to get these headers included so I can continue on with my program?
 
I figured it out, it was a twofold problem. First, there was a typo in my header file, after a class declaration I didn't have a semicolon (';') after the closing brace ('}').

Also, I found if I reorganized the include statements to the following order, the compiler stopped complaining:

#include <string>
#include "gp32.h"
#include "cpp_prototypes.h"

It looks like A) cpp_prototypes.h should definately be after the standard CPP includes, and B) fileio.h isn't needed if you include the standard C++ includes.
 
Yeah, one should always put standard includes before custom ones, in C and C++.
Yeah, I've been working a lot with higher-level languages recently (Python, PHP, Java), so my C/C++ is pretty sloppy.

Mind you, C and C++ are pretty sloppy languages, so... ;) I wish that more strictly typed and bounds-checked / garbage collected languages were more popular for these kinds of things, actually... I get pretty tired of doing all my own error checking. ;)
 
Last edited by a moderator:
Back
Top