STL support?

Post Reply
mido
Posts: 7
Joined: Tue Feb 24, 2009 8:53 am

STL support?

Post by mido » Tue Feb 24, 2009 8:55 am

What happened to the default integration of some of the STL types?

I was using std::string in a few font-related rendering things I had going, and now I need to rewrite some major parts of my program, what happened?

I compared the string header from an older toolchain and the latest; the latest definitely has occluded pretty much the entire header in favor for a basic_string type, is there a justification for throwing away std::string? I imagine that the general STL containers have a habit of stomping around in memory, but I'm pretty sure that string was pretty good about that.


edit: wait I was wrong about the header differences, I compared the wrong files; however, I still can't #include <string> like I could in the past. :(

argh I basically dont know whats going on with the toolchain, I really would like std::string and it seems to be there, just that the configuration wont let me

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: STL support?

Post by WinterMute » Tue Feb 24, 2009 6:37 pm

Are you getting some kind of error?

This works fine for me.

Code: Select all

#include <nds.h>
#include <stdio.h>
#include <string>
#include <iostream>

int main(int argc, char* argv[]){
	
	std::string test="Hello World!";
	
	PrintConsole subScreen;
	videoSetModeSub(MODE_0_2D);
	vramSetBankI(VRAM_I_SUB_BG_0x06208000);
	consoleInit(&subScreen, 0, BgType_Text4bpp, BgSize_T_256x256, 23, 2, false, true);
	std::cout << test;
	while(true)
	{
		swiWaitForVBlank();
	};
	return 0;
}
Help keep devkitPro toolchains free, Donate today

Personal Blog

mido
Posts: 7
Joined: Tue Feb 24, 2009 8:53 am

Re: STL support?

Post by mido » Wed Feb 25, 2009 3:09 am

Total re-edit:
So I totally reinstalled devkitpro .10 on two different computers, two different operating systems XP and Windows 7, and I still cannot compile with STL support. The following error logs are using templates which otherwise compile fine.

Windows XP:

Code: Select all

> "make" 
"make" -C arm7
make[1]: Entering directory `/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm7'
make[2]: `/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/combined.arm7' is up to date.
make[1]: Leaving directory `/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm7'
"make" -C arm9
make[1]: Entering directory `/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9'
template.c
arm-eabi-gcc -MMD -MP -MF /e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/build/template.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/include -I/E/Creativity/Programming/Dependencies/devkitPro/Devreinstall/libnds/include -I/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/build -DARM9 -c /e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c -o template.o
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:9:20: warning: iostream: No such file or directory
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:10:18: warning: string: No such file or directory
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c: In function 'main':
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:23: error: expected expression before ':' token
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:24: error: duplicate label 'std'
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:23: error: previous definition of 'std' was here
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:24: error: expected expression before ':' token
e:/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9/source/template.c:23: warning: label 'std' defined but not used
make[2]: *** [template.o] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/e/Creativity/Programming/Dependencies/devkitPro/Devreinstall/examples/nds/templates/combined/arm9'
"make": *** [arm9/combined.elf] Error 2

> Process Exit Code: 2
> Time Taken: 00:01
Windows 7:

Code: Select all

> "make" 
"make" -C arm7
make[1]: Entering directory `/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm7'
make[2]: `/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/combined.arm7' is up to date.
make[1]: Leaving directory `/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm7'
"make" -C arm9
make[1]: Entering directory `/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9'
template.c
arm-eabi-gcc -MMD -MP -MF /c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/build/template.d -g -Wall -O2 -march=armv5te -mtune=arm946e-s -fomit-frame-pointer -ffast-math -mthumb -mthumb-interwork -I/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/include -I/C/Data/Programming/Dependencies/devkitPro/libnds/include -I/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/build -DARM9 -c /c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c -o template.o
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:36:18: warning: string: No such file or directory
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:37:20: warning: iostream: No such file or directory
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c: In function 'main':
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:41: error: expected expression before ':' token
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:47: error: duplicate label 'std'
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:41: error: previous definition of 'std' was here
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:47: error: expected expression before ':' token
c:/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9/source/template.c:41: warning: label 'std' defined but not used
make[2]: *** [template.o] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/Data/Programming/Dependencies/devkitPro/examples/nds/templates/combined/arm9'
"make": *** [arm9/combined.elf] Error 2

> Process Exit Code: 2
> Time Taken: 00:02

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: STL support?

Post by WinterMute » Wed Feb 25, 2009 2:03 pm

make clean, rename arm9/source/template.c to arm9/source/template.cpp, recompile, kick yourself :p

Seriously though, .c is C code, .cpp is C++.
Help keep devkitPro toolchains free, Donate today

Personal Blog

mido
Posts: 7
Joined: Tue Feb 24, 2009 8:53 am

Re: STL support?

Post by mido » Wed Feb 25, 2009 7:48 pm

If I gave you my address, could you come to my house and hurt me? Image

This is something I should have caught, too, my original implementation of some of my code was within an extern "C" function that had the main loop, so of course it ran, but I re-implemented and... uuughhh
EDIT: I explained that terribly

So sorry to waste your time

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests