Omnimaga
Omnimaga => Completed => Our Projects => Nspire I/O => Topic started by: compu on November 19, 2013, 03:30:07 pm
-
After ExtendeD added support for C++ to Ndless (http://ndlessly.wordpress.com/2013/06/15/cpp-for-the-ti-nspire/) some months ago, I have added experimental C++ support to Nspire I/O now.
It has an iostream-like interface, so it should be easy to use (at least I hope it is :P )
The obligatory "Hello World":
#include <nspireio/console.hpp>
int main(void)
{
nio::console c;
c << "Hello World!" << nio::endl;
return 0;
}
A more complete demo can be found here (https://github.com/compujuckel/nspire-io/blob/master/demo/cplusplus/cplusplus.cpp).
The output of that demo is attached below.
The source code can be found on Github (https://github.com/compujuckel/nspire-io) and in the attached zip file (that contains the compiled library file and demos as well).
-
Good to hear. :) I wonder if the PRIZM version has been cancelled or if it's still in development btw?
-
That is awesome! I like Nspire I/O. Thanks! :)
-
Good to hear. :) I wonder if the PRIZM version has been cancelled or if it's still in development btw?
I think I can call it an indefinite hiatus. I might pick it back up someday, but last time I tried, everything I compiled (NspireIO or not) crashed. Probably my installation of PrizmSDK. Anyway, I wonder if C++ support won't mess that up, since the Prizm have none of it...
-
That's great to hear. Did you solve the inheritance issues that you posted about in another thread?
-
Yup. I tried it with another approach without multiple inheritance and for now, everything seems to work more or less :P
-
Nice Juju, that can make me go back to nSpire! :p
-
Hi ,
every time i pass some variables to nspireio the programm crahes if i try to execute it.
I've no idea whats wrong.
I basicely only modified the exampel to display a cstring and a string. but it doesn't
work...
The programm crahes if i pass the variables with << operator.
#include <nspireio/console.hpp>
#include <nspireio/uart.hpp>
#include <string.h>
#include <string>
#include <iostream>
#ifndef NIO_TEST_UART
#define NIO_TEST_UART 0
#endif
using namespace std;
using namespace nio;
int main(void)
{
clrscr();
#if NIO_TEST_UART == 1
nio::uart u;
#endif
nio::console c;
int num = 123;
char cString[] = "Test";
string cppString = "Text";
c.foreground_color(COLOR_BLACK);
c << cString << endl;
c << cppString.c_str() << endl;
wait_key_pressed();
return 0;
}
Does anyone have a clue?
Thanks
-
Hi Silversircel,
There isn't a port of the Standard library for the calculator. Here is a link to the syscalls: http://hackspire.unsads.com/wiki/index.php/Syscalls
I tend to use the char pointer (char*) and strcpy, strcat, etc. Hope that helps!
-
Silversircel doesn't use the C standard library in his/her program.
Also, there's newlib, and many of the functions in it work.
-
Hey Legimet,
Oh? I see the user does all of these:
#include <string>
using namespace std;
string cppString = "Text";
As I understand newlib (https://sourceware.org/newlib/libc.html#Strings) it gives you a lot but this user is using the C++ string header file; and I think the C++ string class can throw exceptions and other things. I didn't think the C++ std::string class would work at all. But I'll give it a try when I get the chance! :)
Sorry if I wasn't accurate! Have a great day!