| View previous topic :: View next topic |
| Author |
Message |
yotryu
Joined: 30 Sep 2008 Posts: 6
|
Posted: Tue Sep 30, 2008 10:54 am Post subject: C++ library files not compiling with pspsdk |
|
|
Hey all,
I'm new to the psp development scene and am having some trouble using the C++ standard library files (like "string" and "math" etc).
Basically, I have set up MinPSPW to work with VC++ 2008 and I can compile the samples no worries, but on trying to include any files not part of the psp library (and things like "stdlib.h"), I get hundreds of errors.
My makefile has
INCDIR = C:/pspsdk/psp/include/c++/4.3.2/
and without it the compiler won't find the files, but like I said I get hundreds of errors, most looking like this:
1>C:/pspsdk/psp/include/c++/4.3.2/bits/basic_string.h(836) : error: expected declaration specifiers before 'template'
but there are some variations.
I'm assuming I have something setup incorrectly or it's because I'm not using cygwin and all that to do it (honestly, I've tried that before but being able to use VC++ and build from it is much more appealing).
If anybody can give some suggestions I'd greatly appreciate it :)
Thanks in advance,
Jonathan |
|
| Back to top |
|
 |
Dariusc123456
Joined: 12 Aug 2008 Posts: 394
|
Posted: Tue Sep 30, 2008 12:10 pm Post subject: |
|
|
| Can you post your code to your program and makefile? Sometimes, its the makefile that causes the problem. |
|
| Back to top |
|
 |
yotryu
Joined: 30 Sep 2008 Posts: 6
|
Posted: Tue Sep 30, 2008 12:48 pm Post subject: |
|
|
Yeah no worries.
Here's the makefile:
| Code: |
TARGET = celshading
OBJS = lightmap.o celshading.o ../common/callbacks.o
INCDIR = C:/pspsdk/psp/include/c++/4.3.2
CFLAGS = -G0 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS= -lstdc++ -lpspgum -lpspgu -lm
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Celshading Sample
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
lightmap.o : lightmap.raw
bin2o -i lightmap.raw lightmap.o lightmap
|
Now the program code compiles unless I add a line to include one of the files I want to use. For example:
#include <string>
will cause hundreds of errors... literally, about 700+
The full program code is just one of the samples (celshading) that I have been playing around with just to see what the PSP can do ;)
The includes of the file look like this:
| Code: |
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <pspctrl.h>
#include <pspgu.h>
#include <pspgum.h>
#include <string>
#include "../common/callbacks.h"
PSP_MODULE_INFO("Celshading", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
|
Thanks for the quick reply. I hope this helps you to help me ;)
Jonathan |
|
| Back to top |
|
 |
Dariusc123456
Joined: 12 Aug 2008 Posts: 394
|
Posted: Tue Sep 30, 2008 1:26 pm Post subject: |
|
|
| First, remove line "PSP_MAIN_THREAD", because you have it user mode already. Maybe it will lower the errors. Ill see whats the problem, maybe its the line in the makefile that lead to the ../psp/include/c++ , dont exist. Ill see what I can do for you soon |
|
| Back to top |
|
 |
yotryu
Joined: 30 Sep 2008 Posts: 6
|
Posted: Tue Sep 30, 2008 7:36 pm Post subject: |
|
|
Ok turns out one big problem was that I missed one of the first errors... it was a missing file.
So now I'm left with 38 errors (from including <string>), all of which are:
1. error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std' OR
2. error: expected '=', ',', ';', 'asm' or '__attribute__' before '__gnu_cxx' OR
3. error: expected identifier or '(' before string constant
I thought this might mean errors in the code but I really don't know. The errors are located when this is encountered (errors 1 and 2):
_GLIBCXX_BEGIN_NAMESPACE(X)
where:
# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
and a couple for this too (error 3):
extern "C++" {
I've not had experience with gcc errors before so I'm really not sure what I'm looking for and I can't find anything to help on these.
Thanks again for any help anyone can give :)
Jonathan |
|
| Back to top |
|
 |
jojojoris
Joined: 30 Mar 2008 Posts: 261
|
Posted: Tue Sep 30, 2008 10:57 pm Post subject: |
|
|
| the extension of a c++ source file must be .cpp |
|
| Back to top |
|
 |
yotryu
Joined: 30 Sep 2008 Posts: 6
|
Posted: Wed Oct 01, 2008 12:13 am Post subject: |
|
|
Wow. I can't believe I let that slip past me...
I guess that's one thing that can happen if you're using other files instead of creating your own. Teach me to try out samples :P
Thanks very much for the basic advice jojojoris. I'll admit at first I thought it was a rather pointless comment...
Again thanks for the help guys :)
Jonathan |
|
| Back to top |
|
 |
a_noob
Joined: 17 Sep 2006 Posts: 97 Location: _start: jr 0xDEADBEEF
|
Posted: Wed Oct 01, 2008 3:03 pm Post subject: |
|
|
it can be .cpp .C .cc or .c++ all are valid C++ files _________________
| Code: | .øOº'ºOø.
'ºOo.oOº' |
|
|
| Back to top |
|
 |
jojojoris
Joined: 30 Mar 2008 Posts: 261
|
Posted: Thu Oct 02, 2008 2:16 am Post subject: |
|
|
| a_noob wrote: | | it can be .cpp .C .cc or .c++ all are valid C++ files |
that's not true.
the toolchain compiles .C files with psp-gcc and .cpp/.c++ with psp-g++ |
|
| Back to top |
|
 |
Heimdall
Joined: 10 Nov 2005 Posts: 259 Location: Netherlands
|
Posted: Thu Oct 02, 2008 2:28 am Post subject: |
|
|
| it shouldn't, the GCC is supposed to interpret .C as C++ files thus compiling with with g++ |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Thu Oct 02, 2008 5:06 am Post subject: |
|
|
| jojojoris wrote: | | a_noob wrote: | | it can be .cpp .C .cc or .c++ all are valid C++ files |
that's not true.
the toolchain compiles .C files with psp-gcc and .cpp/.c++ with psp-g++ |
you're wrong or are using a cygwin/mingw32 gcc which doesn't handle case matching. |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Thu Oct 02, 2008 5:15 am Post subject: |
|
|
yeah, windows fs is not case sensitive, so file.C is the same as file.c on w32 _________________ ...sorry for my english... |
|
| Back to top |
|
 |
|