Omnimaga
Calculator Community => TI Calculators => Calculator C => Topic started by: Mohammed Elborolossy on November 17, 2014, 02:47:47 pm
-
Hi
I'm a new user and my calc is TI Nspire CX CAS
First: How can i write code in c++ not c ?
Second :I'm good in c++ but i can't make input from user how can i do this ?
Third : I write a code in c and I use "scanf()" to take input from user and when I test it on emulator , the emulator stuck what the problem ?
Forth : What is the important include that i should write before the program ? " the program contains input from user "
Fifth and least : is there any tutorial "pdf or videos " for programming ti nspire cx cas ? can I make a GUI app ?
-
Hi
I'm a new user and my calc is TI Nspire CX CAS
First: How can i write code in c++ not c ?
Use .cpp as file extension, not .c.
Second :I'm good in c++ but i can't make input from user how can i do this ?
Use nspire-io, directly or indirectly. The new SDK at https://github.com/ndless-nspire/Ndless has nspire-io support built-in, just look at samples/newlib.
You can use scanf, std::cin, ifstream, whatever you like.
Third : I write a code in c and I use "scanf()" to take input from user and when I test it on emulator , the emulator stuck what the problem ?
It waits for serial input. By default std* are the first UART.
Forth : What is the important include that i should write before the program ? " the program contains input from user "
?
Fifth and least : is there any tutorial "pdf or videos " for programming ti nspire cx cas ? can I make a GUI app ?
There is only http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux. You can use some graphics libs like nSDL, n2dlib or nGL or rip an existing program apart and use its GUI stuff, like pyWrite.
-
Thank you for reply
Use nspire-io, directly or indirectly. The new SDK at https://github.com/ndless-nspire/Ndless (https://github.com/ndless-nspire/Ndless) has nspire-io support built-in, just look at samples/newlib.
You can use scanf, std::cin, ifstream, whatever you like.
What is the header file that i will include it will be "#include <nspire-io> ?
It waits for serial input. By default std* are the first UART.
This is my code (I still learning and test small codes)
#include <os.h>
int main() {
printf ("!!!Hello World!!!");
int x ;
scanf("%d" , &x);
printf ("The value is : %d" , x)
return 0;
}
What is the problem for this code (The prog not start to write an input)
Forth : What is the important include that i should write before the program ? " the program contains input from user "
I mean what is the main (#include <>) that without it the app doesn't run ?
Fifth and least : is there any tutorial "pdf or videos " for programming ti nspire cx cas ? can I make a GUI app ?
There is only http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux). You can use some graphics libs like nSDL, n2dlib or nGL or rip an existing program apart and use its GUI stuff, like pyWrite.
can you give me link contains example for GUI code ?
Thanks in advance
-
Thank you for reply
Use nspire-io, directly or indirectly. The new SDK at https://github.com/ndless-nspire/Ndless (https://github.com/ndless-nspire/Ndless) has nspire-io support built-in, just look at samples/newlib.
You can use scanf, std::cin, ifstream, whatever you like.
What is the header file that i will include it will be "#include <nspire-io> ?
#include <nspireio/nspireio.h>
It waits for serial input. By default std* are the first UART.
This is my code (I still learning and test small codes)
#include <os.h>
int main() {
printf ("!!!Hello World!!!");
int x ;
scanf("%d" , &x);
printf ("The value is : %d" , x)
return 0;
}
What is the problem for this code (The prog not start to write an input)
Try a newline or puts instead of printf.
Forth : What is the important include that i should write before the program ? " the program contains input from user "
I mean what is the main (#include <>) that without it the app doesn't run ?
There is no such #include, although you need to #include <os.h> on the old sdk to do something useful.
Fifth and least : is there any tutorial "pdf or videos " for programming ti nspire cx cas ? can I make a GUI app ?
There is only http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux (http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux). You can use some graphics libs like nSDL, n2dlib or nGL or rip an existing program apart and use its GUI stuff, like pyWrite.
can you give me link contains example for GUI code ?
That depends on how you want to do GUI development, which library you use.
Thanks in advance
-
for the GUI
I still in the start and I don't know anything of them
So I wish you recommend me anyone of them to start learn it
I need a simple gui .
-
for the GUI
I still in the start and I don't know anything of them
So I wish you recommend me anyone of them to start learn it
I need a simple gui .
Well, if text is enough you can use nspire-io to display text at specified positions and move using the cursor keys. Or if you want 2d graphics, use nSDL, nGC, n2DLib or nGL.
-
Edited (I make some edit in the code but still has a problem)
The code is :
#include <os.h>
#include <iostream>
#include <stdlib.h>
#include <libndls.h>
using namespace std;
int main() {
cout<<"!!!Hello World!!!";
int x ;
cin>> x;
cout<<"The value is :" << x ;
return 0;
}
The compile result :
>C:\ndless-sdk-v3.6-r53.464a532/mingw-get/msys/1.0/bin/sh -l -c 'PATH="$PATH":\'/C/ndless-sdk-v3.6-r53.464a532/ndless/bin:/C/ndless-sdk-v3.6-r53.464a532/yagarto/bin\' C_INCLUDE_PATH="$C_INCLUDE_PATH":\'/C/ndless-sdk-v3.6-r53.464a532/ndless_pc/include\' LIBRARY_PATH="$LIBRARY_PATH":\'/C/ndless-sdk-v3.6-r53.464a532/ndless_pc/lib\' \'/C/ndless-sdk-v3.6-r53.464a532/ndless/bin/nspire-gcc\' -Os -c hello.cpp'
>Exit code: 0
The Build result :
Please choose a name for the program below.
Makefile created. You can now build with the 'make' command or Ndless Editor's Tools>Build command.
mkdir -p .
nspire-ld-bflt hello.o -o ./First.tns --cpp
c:/ndless-sdk-v3.6-r53.464a532/yagarto-20121222/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/ld.exe: warning: cannot find entry symbol lf2flt; defaulting to 00000000
Built.
When i test it on emu (I'm already install ndless on emu and check before i run the prog.)
apper a message that prog. not supported
other thing the cpp file is 1 kB
The TNS file is 4.1 MB ? it seems large
-
That's expected, to use libstdc++ you have to use the new SDK.
-
That's expected, to use libstdc++ you have to use the new SDK.
I still has the same problem
I tried the two version from the official ndless site
If you Anyone has the (Ndless sdk) and work fine with c++ and emulator please upload the folder
Thanks in advance
-
I tried the two version from the official ndless site
They're both the old sdk. The new SDK is on Github.
If you Anyone has the (Ndless sdk) and work fine with c++ and emulator please upload the folder
Windows? Cygwin?
-
Windows? Cygwin?
I'm using windows 8.1
What do you mean about Cygwin ?
-
Cygwin is a program which gives a unix-like mini environment to a Windows user. It installs some binaries, a folder with the structure of a Linux distribution, a shell ( a command line program, like command invite) and you have a similar environement as a Linux should be.
-
Cygwin is a program which gives a unix-like mini environment to a Windows user. It installs some binaries, a folder with the structure of a Linux distribution, a shell ( a command line program, like command invite) and you have a similar environement as a Linux should be.
I have Ubuntu and windows 8.1 and I try the booth
In Ubuntu : I follow this tutorial : http://hackspire.unsads.com/wiki/index.php/C_and_assembly_development_introduction_on_Linux
After this code "./build_toolchain.sh" and after download i get two errors and try to solve them but not success
In windows 8.1 : I download the sdk and a download yagarto additional files and write a c++ program the compile complete but in build there is an error : cannot find entry symbol lf2flt; defaulting to 00000000
[/size]
-
It's better if you use Linux.
After this code "./build_toolchain.sh" and after download i get two errors and try to solve them but not success
Which two errors?
-
I think that this is one :
configure: error: no termcap library found
I search for "termcap" in synaptic but not found it
-
this is the last lines in the Terminal :
checking for library containing waddstr... no
configure: WARNING: no enhanced curses library found; disabling TUI
checking for library containing tgetent... no
configure: error: no termcap library found
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory `/home/mohammed/Ndless/ndless-sdk/toolchain/build'
make: *** [all] Error 2
-
It's called "libtinfo-dev" in Ubuntu.
PS: Please don't double-port, the Modify button is there for a reason.
-
It's called "libtinfo-dev" in Ubuntu.
PS: Please don't double-port, the Modify button is there for a reason.
I'm sorry for that.
The download complete and Done
What is the next?
I can't understand this code
when i write it in the terminal and change the path there no thing done
i skip to the next code "make"
the result is : "make: *** No targets specified and no makefile found. Stop."
-
If you ran build_toolchain.sh successfully and set PATH, execute "make" in the ndless-sdk directory.
-
I'm sorry for disturbance
but with each step there a lot of errors
There is an Error with luna.o
the result after write "make" :
make all in ndless-sdk...
make[1]: Entering directory `/home/mohammed/Ndless/ndless-sdk'
make all in tools...
make[2]: Entering directory `/home/mohammed/Ndless/ndless-sdk/tools'
make all in luna...
make[3]: Entering directory `/home/mohammed/Ndless/ndless-sdk/tools/luna'
gcc -W -Wall -DUSE_FILE32API -c -o luna.o luna.c
luna.c:1:33: fatal error: openssl/opensslconf.h: No such file or directory
#include <openssl/opensslconf.h>
^
compilation terminated.
make[3]: *** [luna.o] Error 1
make[3]: Leaving directory `/home/mohammed/Ndless/ndless-sdk/tools/luna'
make[2]: *** [all] Error 1
make[2]: Leaving directory `/home/mohammed/Ndless/ndless-sdk/tools'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/mohammed/Ndless/ndless-sdk'
make: *** [all] Error 1
-
If openssl is missing, install openssl. It's likely libssl-dev.
-
Another Error :/
make[1]: Leaving directory `/home/mohammed/Ndless/ndless-sdk/libsyscalls'
make all in libndls...
make[1]: Entering directory `/home/mohammed/Ndless/ndless-sdk/libndls'
nspire-gcc -Os -nostdlib -Wall -Werror -Wextra -c any_key_pressed.c
make[1]: nspire-gcc: Command not found
make[1]: *** [any_key_pressed.o] Error 127
make[1]: Leaving directory `/home/mohammed/Ndless/ndless-sdk/libndls'
make: *** [all] Error 1
-
You didn't set PATH correctly. It has to include ndless-sdk/bin.
-
You didn't set PATH correctly. It has to include ndless-sdk/bin.
How to include the path?
I write it like this :
mohammed@mohammed-HP:~$ export PATH="/home/mohammed/Ndless/ndless-sdk/toolchain/install/bin:/home/mohammed/Ndless/ndless-sdk/toolchain/bin:${PATH}"
I put the Ndless in Home file
/home/mohammed/Ndless/ndless-sdk
-
Yeah, like that. The second path doesn't exist, though.
-
Yeah, like that. The second path doesn't exist, though.
I think it's solved now
I'm very thankful for your effort with me
The last question where I will write my code ( will I write a c++ on any ide or Terminal?)
-
That's your decision.
Most IDEs support plain Makefile projects. You only need to execute "nspire-tools new <program name>" and you can start coding in that directory.
Your IDE just has to run "make" to build the program. I know that the following IDEs definitely work:
- Qt Creator
- Eclipse
- Vi
- Code::Blocks
- KDevelop
- SciTE
-
I'm sorry to say that i can't run any program till now
i follow the tutorial as i said before
in the sample example the tns file obtained but not working on the emulator
When I try to make a prog. and write : nspire-tools new <main> "main is my program name that error appear
bash: syntax error near unexpected token `newline'
What is the problem ??
I write a code on codeblocks and eclipse but how to complete after that ?
-
in the sample example the tns file obtained but not working on the emulator
Try the .prg.tns file.
When I try to make a prog. and write : nspire-tools new <main> "main is my program name that error appear
Leave the "<>" out.
-
Try the .prg.tns file.
Already try and it didn't open any thing.
Leave the "<>" out.
Can you write a helloworld prog in c++ and mention the steps from terminal or using an exist CPP file
I am very sorry about asking alot
-
Already try and it didn't open any thing.
Then please upload the generated file.
Can you write a helloworld prog in c++ and mention the steps from terminal or using an exist CPP file
I am very sorry about asking alot
echo "int main() { return 0; }" > main.cpp
nspire-tools new test
make
Done. The program does nothing, though.
-
There is an error that nspire-tools command not found ?
-
Then your PATH isn't set up correctly.
-
Then your PATH isn't set up correctly.
I'm sorry for late
Is there a specific path ?
-
nspire-tools in in ndless-sdk/bin