Homebrew C++11 support for 3DS Homebrew

Stratbasher

New Member
OP
Newbie
Joined
Aug 11, 2016
Messages
2
Trophies
0
Age
28
XP
51
Country
United States
Hey guys,

I'm just getting into developing homebrew for the 3ds and I'm really looking to use C++ over c.

Call me lazy, but I just want to use the to_string function to convert integers to strings. While it looks like some C++11 support is there (such as "auto" working), I get this error....

Code:
string consolePos(int r, int c)
{
    string result = "\x1b[" + std::to_string(r) + ";" + std::to_string(c) + "H";
    return result;
}

Code:
In function 'std::__cxx11::string consolePos(int, int)':
error: 'to_string' is not a member of 'std'

If I try removing the "std::" from the function, it just says that to_string is undefined.

Is there something I'm missing blatantly? My makefile contains....
Code:
CXXFLAGS := $(COMMON_FLAGS) -std=c++11

EDIT 2: Solved. Am dumb. Forgot to add
Code:
#include <iostream>
and
Code:
#include <string>
 
Last edited by Stratbasher,

Wabsta

you fight like a dairy farmer
Member
Joined
Apr 25, 2008
Messages
2,495
Trophies
0
Age
32
Location
SCUMM Bar
Website
www.wabsta.com
XP
449
Country
Netherlands
I have no knowledge of 3DS development at all (I wish), but maybe you could try a stringstream for what you're doing?

Code:
#include <sstream>

string consolePos(int r,int c){
    std::stringstream stream;
    stream << "\x1b[" << r << ";" << c << "H";
    return stream.str();
}

(been a while since I've coded in C++, but I thing this should work)
 

Stratbasher

New Member
OP
Newbie
Joined
Aug 11, 2016
Messages
2
Trophies
0
Age
28
XP
51
Country
United States
I believe it would, but it's still strange that it doesn't let me use to_string.

Thank you for the code snippet. I will probably use that for now. I have heard that it's a bit slower performance-wise though.

EDIT: It seems I can't use cout either... How would I log to the console with cpp instead of straight c with printf (I really don't like C lol)
 
Last edited by Stratbasher,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • FlareReZ @ FlareReZ:
    Try using a different SD card or a different USB port.
  • BeanMKW @ BeanMKW:
    @ZeroT21 @FlareReZ nah i meant i literally dont have an sd port. i just got the old laptop out and updated lol
    +1
  • K3N1 @ K3N1:
    It doesn't have usb?
  • K3N1 @ K3N1:
    I got one of these surly your new pc at least has a USB port https://a.co/d/av6BnXX
  • BeanMKW @ BeanMKW:
    ya it does
  • BeanMKW @ BeanMKW:
    i just need one of those usb sd adapters lol
  • BeanMKW @ BeanMKW:
    i had to update to use nusspli.. sspeaking of nusspli, my wii u doesnt auto shutdown during it, right? rayman legends downloading kinda slow
  • K3N1 @ K3N1:
    I'd get one with a type c/usb adapter like mine so if in a pinch you could use a file manager app on your phone
  • BeanMKW @ BeanMKW:
    nah
  • BeanMKW @ BeanMKW:
    i would never need that lol
  • K3N1 @ K3N1:
    Never know they come in handy
  • BeanMKW @ BeanMKW:
    using a phone, even with amaze or something, is just too tedious for me
  • K3N1 @ K3N1:
    You could just use the type A side then C is just quickly over taking everything
  • K3N1 @ K3N1:
    Both in one package is just nice
  • BeanMKW @ BeanMKW:
    i swear nusspli keeps network erroring
  • BeanMKW @ BeanMKW:
    i hope that doesnt cause any issues
  • HiradeGirl @ HiradeGirl:
    where's my food?
  • K3N1 @ K3N1:
    The hell TVs have a qned thing
  • HiradeGirl @ HiradeGirl:
    thats when tvs get q problems
  • YukiHomura @ YukiHomura:
    @FlareReZ i never liked TikTok. used it once to see how it is and stopped after 10 min. LMFAO
    +1
  • YukiHomura @ YukiHomura:
    i use this
  • a_username_that_is_cool @ a_username_that_is_cool:
    i use a sandisk cruzer glide
  • YukiHomura @ YukiHomura:
    my usb i use is a SanDisk Ultra Fit
  • The Real Jdbye @ The Real Jdbye:
    @YukiHomura 10 min too much
    +1
    The Real Jdbye @ The Real Jdbye: @YukiHomura 10 min too much +1