Compiling multiple .cpp files
8 posts
• Page 1 of 1
Compiling multiple .cpp files
When programming in cpp i like to create a .cpp and .h file for every bigger class. Is it possible to compile multiple cpp-files into one tns-file? And how can i set it up? What do i need to change in the makefile?
-
Rankail
Niveau 4: MC (Membre Confirmé)- Posts: 21
- Joined: 09 Nov 2019, 18:33
- Location: Germany, North Rhine-Westfalia
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: 12
Re: Compiling multiple .cpp files
Yes of course. You have to specify every source file to your command.
I suggest you create a Makefile in order to do everything for you. And the SDK already has a pretty useful command to create a ready-to-use makefile.
Use
I suggest you create a Makefile in order to do everything for you. And the SDK already has a pretty useful command to create a ready-to-use makefile.
Use
nspire-tools new <name of the project>

-
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 3446
- Images: 75
- Joined: 04 Jul 2014, 14:40
- Location: Clermont-Ferrand 63
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: ENS Rennes
- GitHub: Ti64CLi
Re: Compiling multiple .cpp files
I have already created a makefile with that command. I wanted to know if i need to change anything in it to compile other cpp files int the same directory. It sounds like i don't need to do anything?
-
Rankail
Niveau 4: MC (Membre Confirmé)- Posts: 21
- Joined: 09 Nov 2019, 18:33
- Location: Germany, North Rhine-Westfalia
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: 12
Re: Compiling multiple .cpp files
No, just put all your .cpp and .h(pp) files in the same directory as the makefile, and you're good to go. Just type 
make
in your console 
-
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 3446
- Images: 75
- Joined: 04 Jul 2014, 14:40
- Location: Clermont-Ferrand 63
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: ENS Rennes
- GitHub: Ti64CLi
Re: Compiling multiple .cpp files
Nice. That's way easier than i thought. Thanks.
-
Rankail
Niveau 4: MC (Membre Confirmé)- Posts: 21
- Joined: 09 Nov 2019, 18:33
- Location: Germany, North Rhine-Westfalia
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: 12
Re: Compiling multiple .cpp files
It is even not mandatory to have everything in the same directory than the makefile.
All subdirectories placed in the folder where is the makfile will also be scanned and treated.
Be aware of that cause it can be usefull for sorting files but can also create some issues if your project contains several versions of file with same function names.
Br
Sly
All subdirectories placed in the folder where is the makfile will also be scanned and treated.
Be aware of that cause it can be usefull for sorting files but can also create some issues if your project contains several versions of file with same function names.
Br
Sly
Some works in progress :
The GUI Toolkit NF for nSpire | MyShmup for fxCG-50 | Magic Light for Casio Graph 90+E and Magic Light for nSpire CX/CX-II | Simple Text Editor for nSpire | OutRun for Casio Graph 90+E |
![]() | ![]() | ![]() | ![]() | ![]() |
And more to come ... stay tuned
-
SlyVTTPremium
Niveau 12: CP (Calculatrice sur Pattes)- Posts: 547
- Images: 32
- Joined: 19 Jan 2021, 09:41
- Location: France
- Gender:
- Calculator(s):→ MyCalcs profile
- GitHub: SlyVTT
Re: Compiling multiple .cpp files
Oh. Even better than i thought
-
Rankail
Niveau 4: MC (Membre Confirmé)- Posts: 21
- Joined: 09 Nov 2019, 18:33
- Location: Germany, North Rhine-Westfalia
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: 12
-
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)- Posts: 3446
- Images: 75
- Joined: 04 Jul 2014, 14:40
- Location: Clermont-Ferrand 63
- Gender:
- Calculator(s):→ MyCalcs profile
- Class: ENS Rennes
- GitHub: Ti64CLi
8 posts
• Page 1 of 1
Return to Native: Ndless, Linux, ...
Who is online
Users browsing this forum: ClaudeBot [spider] and 4 guests