forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

string type problem

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
egorive



Joined: 22 Jun 2006
Posts: 24

PostPosted: Sun Jul 20, 2008 8:25 am    Post subject: string type problem Reply with quote

Hi, have try to find information about why i obtain the error when compiling my program :


**** Build of configuration Default for project HelloWorldCPP ****

make all
psp-g++ -I. -ID:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -ID:/cygwin/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -c -o main.o main.cpp
main.cpp: In function 'void ejemplo_estructuras()':
main.cpp:35: error: 'string' does not name a type
main.cpp:36: error: 'string' does not name a type
main.cpp:37: error: 'string' does not name a type
main.cpp:38: error: 'string' does not name a type
main.cpp:49: error: 'struct ejemplo_estructuras()::habitacion' has no member named 'piano'
.
.
.(etc)


This is the original code:

#include <pspkernel.h>
#include <pspdebug.h>
#include <string.h>
#include "OtrasFunciones.h"
#include "PruebaDeClases.h"

using namespace std;

...(etc)

void ejemplo_estructuras(){
int num_mesillas=2;

struct habitacion{
string piano;
string cama;
string mesa;
string armario;
int *mesillas;

};

...(etc)


And my makefile:

TARGET = template
OBJS = main.o OtrasFunciones.o PruebaDeClases.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LIBS = -lstdc++ -lc -lpsplibc
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Template


PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

main.cpp : OtrasFunciones.h PruebaDeClases.h
OtrasFunciones.cpp : OtrasFunciones.h
PruebaDeClases.cpp : PruebaDeClases.h

Perhaps I don't have the library that gives this funcionality added in my makefile but i don't know which one to chose and i have try to find information about this.. but nothing. So sorry if it is a silly question I am a newbe.

Thanks.
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Sun Jul 20, 2008 11:35 am    Post subject: Reply with quote

replace

#include <string.h>

by:

#include <string>
_________________
--pspZorba--
NO to K1.5 !
Back to top
View user's profile Send private message
egorive



Joined: 22 Jun 2006
Posts: 24

PostPosted: Sun Jul 20, 2008 4:18 pm    Post subject: clearing my mind... Reply with quote

So ... żis the reason something close to this?

<string> is the new include for c++ which have the string type definition and so on and

<string.h> is the old c include that give us functions like strcpy or strlen..
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Sun Jul 20, 2008 11:07 pm    Post subject: Reply with quote

correct
_________________
--pspZorba--
NO to K1.5 !
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Mon Jul 21, 2008 11:59 pm    Post subject: Reply with quote

Depends if you want string or char *.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group