string type problem

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
egorive
Posts: 24
Joined: Thu Jun 22, 2006 11:50 pm

string type problem

Post by egorive »

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.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

replace

#include <string.h>

by:

#include <string>
--pspZorba--
NO to K1.5 !
egorive
Posts: 24
Joined: Thu Jun 22, 2006 11:50 pm

clearing my mind...

Post by egorive »

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..
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

correct
--pspZorba--
NO to K1.5 !
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Depends if you want string or char *.

Jim
Post Reply