Will any C++ code work?

Discussion in '3DS - Homebrew Development and Emulators' started by Eddypikachu, Oct 20, 2016.

  1. Eddypikachu
    OP

    Eddypikachu GBAtemp Fan

    Member
    394
    149
    Mar 25, 2015
    United States
    Hey I'm new to programming and I'm wondering if any code I write C++ wil work on 3ds? Like can I do something as simple as
    intmain()
    {
    std::cout<<"Hello world!"<<std::endl;
    return0;
    }


    compile it as 3dsx and it would work on 3ds?
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    806
    296
    Jul 28, 2008
    United States
    Aside from the obvious syntax errors - yes, this would compile. It would not do what you expect though. you would need to add 3ds specific code to initialize one of the screens for console output. And you would probably want to add some code to loop after the cout statement so that you can actually see the output before it closes.
    But will any C++ code work? No, code specific to a different platform will not work. If you are asking if you can use C++ then the answer is yes.
     
    Eddypikachu likes this.