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 

[Beginner Question] STL usage issues

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



Joined: 06 Nov 2008
Posts: 2

PostPosted: Thu Nov 06, 2008 12:00 pm    Post subject: [Beginner Question] STL usage issues Reply with quote

Hi ps2dev community,
First of all, thanks to all developers that contribute(d) their time and knowledge to create this GREAT! project ;)

However, just some days ago I started exploring the PS2 homebrew/indie development world, and I have to say I'm all excited.

Ok, got the PS2 Independence exploit working, downloaded the precompiled win32 version of the ps2dev sdk (from here), compiled one of the samples that come with it and ran it on my PS2 -> FUN !!

Now I'm trying to extend the samples / write my own programs and now to my first question (I tried to search for similar threads, but found no concrete answer, sry)...
Does the ps2dev sdk provide STL support? I saw that there are STL headers included in the package that I downloaded, but are they available for use?

When I tried to make use the the STL string class I got some serious compilation issues...
(sry, I'm a gcc/makefile newb, so I can't get much out of the error log)

My .cc file:
Code:
#include <stdio.h>
#include <string>

int main(int argc, char **argv)
{
   printf("START ");

   std::string myStr = "myTestString";

   printf("EOP ");

   return 0;

}


My makefile:
Code:
EE_BIN = cpp-test.elf
EE_OBJS = cpp-test.o
EE_LIBS = -lstdc++ -ldraw -lgraph -lmath3d -lmf -lpacket -ldma

all: $(EE_BIN)
   ee-strip --strip-all $(EE_BIN)

clean:
   rm -f *.elf *.o *.a

include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal


gcc output:
Code:
C:\ps2dev\ps2sdk\samples\cpp-test>make
ee-g++ -D_EE -O2 -G0 -Wall  -IC:/ps2dev/ps2sdk/ee/include -IC:/ps2dev/ps2sdk/common/include -I.  -c cpp-test.cc -o cpp-test.o
ee-gcc -mno-crt0 -TC:/ps2dev/ps2sdk/ee/startup/linkfile -LC:/ps2dev/ps2sdk/ee/lib  \
                -o cpp-test.elf C:/ps2dev/ps2sdk/ee/startup/crt0.o cpp-test.o -lstdc++ -ldraw -lgraph -lmath3d -lmf -lpacket -ldma -lc -lkernel
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x178):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x180):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x198):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x1a0):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x1bc):../../../../libstdc++-v3/libsupc++/new:89: undefined reference to `_impure_ptr'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ios.o)(.text+0x1c4):../../../../libstdc++-v3/libsupc++/new:89: more undefined references to `_impure_ptr' follow
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale.o)(.text+0x1440):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/bits/basic_string.h:781: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_numERS3_S5_RiiijRKSt5ctypeIcERSt12_Ios_Iostate+0x1dc): In function `__static_initialization_and_destruction_0':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/bits/char_traits.h:123: undefined reference to `atoi'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0x34):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/c++locale.h:49: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0x74):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/bits/locale_facets.tcc:2021: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIdEiPciPKcT_RKPii+0xa0): In function `__static_initialization_and_destruction_0':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/c++locale.h:67: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0x34):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/c++locale.h:49: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0x74):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/bits/locale_facets.tcc:2021: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(locale-inst.o)(.gnu.linkonce.t._ZSt16__convert_from_vIeEiPciPKcT_RKPii+0xa0):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/c++locale.h:67: more undefined references to `setlocale' follow
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(stl-inst.o)(.gnu.linkonce.t._ZNSt24__default_alloc_templateILb1ELi0EE8allocateEj+0xf4):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/bits/stl_alloc.h:109: undefined reference to `__assert'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(stl-inst.o)(.gnu.linkonce.t._ZNSaIcE8allocateEjPKv+0x110):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/gthr-single.h:231: undefined reference to `__assert'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(collate_members.o)(.text+0xc):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/collate_members.cc:46: undefined reference to `strcoll'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(collate_members.o)(.text+0x40):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/collate_members.cc:54: undefined reference to `strxfrm'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(time_members.o)(.text+0x38):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/time_members.cc:47: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(time_members.o)(.text+0x50):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/time_members.cc:48: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(time_members.o)(.text+0x64):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/time_members.cc:49: undefined reference to `strftime'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(time_members.o)(.text+0x70):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/time_members.cc:50: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x1d4): In function `void std::__convert_to_v<long long>(char const*, long long&, std::_Ios_Iostate&, int* const&, int)':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:89: undefined reference to `strtoll'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x28c): In function `void std::__convert_to_v<unsigned long long>(char const*, unsigned long long&, std::_Ios_Iostate&, int* const&, int)':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:106: undefined reference to `strtoull'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x340): In function `void std::__convert_to_v<float>(char const*, float&, std::_Ios_Iostate&, int* const&, int)':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:123: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x35c):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:124: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x38c):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:133: undefined reference to `finitef'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x3c4):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:150: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x470): In function `void std::__convert_to_v<double>(char const*, double&, std::_Ios_Iostate&, int* const&, int)':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:163: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x48c):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:164: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x4d8):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:172: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x570): In function `void std::__convert_to_v<long double>(char const*, long double&, std::_Ios_Iostate&, int* const&, int)':
/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:185: undefined reference to `setlocale'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(c++locale.o)(.text+0x58c):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/c++locale.cc:186: more undefined references to `setlocale' follow
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ctype.o)(.text+0x0):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/ctype_noninline.h:38: undefined reference to `_ctype_'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(ctype.o)(.text+0x8):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/include/ee/bits/ctype_noninline.h:38: undefined reference to `_ctype_'
/cygdrive/c/ps2dev/ee/bin/../lib/gcc-lib/ee/3.2.2/../../../../ee/lib/libstdc++.a(basic_file.o)(.text+0x314):/home/loser/toolchain/gcc-3.2.2/build-ee-c++/ee/libstdc++-v3/src/basic_file.cc:100: undefined reference to `setvbuf'
collect2: ld returned 1 exit status
make: *** [cpp-test.elf] Error 1

C:\ps2dev\ps2sdk\samples\cpp-test>


I would be very thankful for any info or help to get my makefile correct.

thx & cheers
Back to top
View user's profile Send private message
poutine



Joined: 06 Nov 2008
Posts: 4
Location: St-Jean,Qc, Canada

PostPosted: Thu Nov 06, 2008 3:26 pm    Post subject: Free MC Boot Reply with quote

Hello stoneCold.

Quote:
Ok, got the PS2 Independence exploit working


You might be interested by Free MC Boot then.

Danny
Back to top
View user's profile Send private message
ragnarok2040



Joined: 09 Aug 2006
Posts: 230

PostPosted: Thu Nov 06, 2008 6:28 pm    Post subject: Reply with quote

I got this error as well when I was porting snes9x-1.51 without stlport. I'm pretty sure it's related to the string object, and might be related to general input/output streams. I'm still able to compile C++ programs though, as long as it uses C-style strings.

There's a stlport in the subversion repository... at svn://svn.ps2dev.org/ps2/trunk/ps2sdk-ports/stlport. It fixed the string object errors, but then I ran into some template errors.

I don't remember where I read this, but when linking with stlport, you should have these symbols defined in your EE_CXXFLAGS var.

EE_CXXFLAGS += -D_STLP_NO_NAMESPACES -D_NOTHREADS -D_STLP_NO_EXCEPTIONS -D_STLP_USE_NEWALLOC -D_STLP_HAS_WCHAR_T -D_STLP_NO_IOSTREAMS -Dwint_t=int -I$(PS2SDK)/ports/include/stlport/

Hope this helps, :D.
Back to top
View user's profile Send private message
stoneCold



Joined: 06 Nov 2008
Posts: 2

PostPosted: Fri Nov 07, 2008 5:53 am    Post subject: Reply with quote

@ragnarok2040:

thx for the reply,
I tried to add the line you named to my makefile, but it didn't change anything regarding my error log :(

To clearify my question, the compilation issue is not related to the std::string class alone, I get (as far as I can see) the exactly same error log for other STL classes as well, for example if I try to use the vector template...

Code:
#include <stdio.h>
#include <vector>

int main(int argc, char **argv)
{
   printf("START ");

   std::vector<int> myVec;

   printf("EOP ");

   return 0;

}


... same error log :(

I tried to checkout the STL port that you mentioned, but I was unable to compile the source, seems the makefiles in there are no good for use on windows.

anyone an idea?

thx
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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