Author Topic: C++ on the Nspire?  (Read 7964 times)

0 Members and 1 Guest are viewing this topic.

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
C++ on the Nspire?
« on: March 27, 2011, 01:32:22 pm »
I have tried to run C++ on the Nspire by replacing gcc with g++ in nspire-gcc, but the linker spams me with error messages then.
I got this to work once (with r349 I guess), so I was able to make a class with a function that prints something to RS232, but I was unable to use functions of libndls. I don't know how I exactly did this anymore (I reinstalled windows), so my question is, how can I get C++ to work again? If there is a chance to do this, wouldn't it be nice to include an nspire-g++ into ndless then?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: C++ on the Nspire?
« Reply #1 on: March 27, 2011, 01:56:21 pm »
I have tried to run C++ on the Nspire by replacing gcc with g++ in nspire-gcc, but the linker spams me with error messages then.
I got this to work once (with r349 I guess), so I was able to make a class with a function that prints something to RS232, but I was unable to use functions of libndls. I don't know how I exactly did this anymore (I reinstalled windows), so my question is, how can I get C++ to work again? If there is a chance to do this, wouldn't it be nice to include an nspire-g++ into ndless then?

First of all, I'm surprised you managed to get C++ on the NSpire on the first place.
Have no idea how to fix it now, though.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: C++ on the Nspire?
« Reply #2 on: March 27, 2011, 02:04:14 pm »
Perhaps some extern "C" { ... }; blocks would be in order ?

C++ on a Nspire is not really surprising, in fact :)
C++ code is not necessarily bloated (though the more advanced features can indeed yield significant bloat) and hard to compile for embedded platforms: in the absence of "virtual" stuff, things like inheritance and redefinition of some methods' implementation in derived classes, can be compiled to decent machine code. My team-mate (mostly) and I used such C++ code in the internship at the end of our studies, on a mildly embedded platform (several hundreds of KB of Flash memory).
« Last Edit: March 27, 2011, 02:14:39 pm by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: C++ on the Nspire?
« Reply #3 on: March 27, 2011, 02:42:50 pm »
Wow I didn't realize C++ was possible on it. Isn't C++ OOP btw? O.O

By the way shouldn't this be in the calculator help/C sub-forum?
« Last Edit: March 27, 2011, 02:43:53 pm by DJ_O »

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: C++ on the Nspire?
« Reply #4 on: March 27, 2011, 02:49:56 pm »
Wow I didn't realize C++ was possible on it. Isn't C++ OOP btw? O.O
Yes, it is.

By the way shouldn't this be in the calculator help/C sub-forum?
Uhm, I don't know. Feel free to move it :P

Offline compu

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 275
  • Rating: +63/-3
    • View Profile
Re: C++ on the Nspire?
« Reply #5 on: March 30, 2011, 07:36:40 am »
Nobody has a solution?

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: C++ on the Nspire?
« Reply #6 on: March 30, 2011, 07:44:42 am »
Has C++ been ported to ARM9? If it has, it might be best just to use a dedicated toolchain.

EDIT: Well, obviously C++ has been at least partially ported...
« Last Edit: March 30, 2011, 07:45:16 am by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: C++ on the Nspire?
« Reply #7 on: June 24, 2011, 12:26:25 am »
Anyone tried using C++ again with newer versions of ndless? If it works, then I might use it.