π
<-
Chat plein-écran
[^]

Compiling multiple .cpp files

C, C++, ASM...

Compiling multiple .cpp files

Message non lude Rankail » 27 Aoû 2021, 18:38

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?
Avatar de l’utilisateur
Rankail
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 64%
 
Messages: 21
Inscription: 09 Nov 2019, 18:33
Localisation: Germany, North Rhine-Westfalia
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 12

Re: Compiling multiple .cpp files

Message non lude Ti64CLi++ » 27 Aoû 2021, 18:39

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 nspire-tools new <name of the project> ;)
Image
Avatar de l’utilisateur
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 32.3%
 
Messages: 3441
Images: 75
Inscription: 04 Juil 2014, 14:40
Localisation: Clermont-Ferrand 63
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: ENS Rennes
GitHub: Ti64CLi

Re: Compiling multiple .cpp files

Message non lude Rankail » 27 Aoû 2021, 18:45

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?
Avatar de l’utilisateur
Rankail
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 64%
 
Messages: 21
Inscription: 09 Nov 2019, 18:33
Localisation: Germany, North Rhine-Westfalia
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 12

Re: Compiling multiple .cpp files

Message non lude Ti64CLi++ » 27 Aoû 2021, 18:47

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 ;)
Image
Avatar de l’utilisateur
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 32.3%
 
Messages: 3441
Images: 75
Inscription: 04 Juil 2014, 14:40
Localisation: Clermont-Ferrand 63
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: ENS Rennes
GitHub: Ti64CLi

Re: Compiling multiple .cpp files

Message non lude Rankail » 27 Aoû 2021, 19:02

Nice. That's way easier than i thought. Thanks.
Avatar de l’utilisateur
Rankail
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 64%
 
Messages: 21
Inscription: 09 Nov 2019, 18:33
Localisation: Germany, North Rhine-Westfalia
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 12

Re: Compiling multiple .cpp files

Message non lude SlyVTT » 27 Aoû 2021, 19:16

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
Some works in progress :
The GUI Toolkit NF for nSpireMyShmup for fxCG-50Magic Light for Casio Graph 90+E
and
Magic Light for nSpire CX/CX-II
Simple Text Editor for nSpireOutRun for Casio Graph 90+E
95%
50%
100%
75%
100%
And more to come ... stay tuned
Avatar de l’utilisateur
SlyVTTPremium
Niveau 12: CP (Calculatrice sur Pattes)
Niveau 12: CP (Calculatrice sur Pattes)
Prochain niv.: 43%
 
Messages: 482
Images: 31
Inscription: 19 Jan 2021, 09:41
Localisation: France
Genre: Homme
Calculatrice(s):
MyCalcs profile
GitHub: SlyVTT

Re: Compiling multiple .cpp files

Message non lude Rankail » 27 Aoû 2021, 23:22

Oh. Even better than i thought
Avatar de l’utilisateur
Rankail
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 64%
 
Messages: 21
Inscription: 09 Nov 2019, 18:33
Localisation: Germany, North Rhine-Westfalia
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 12

Re: Compiling multiple .cpp files

Message non lude Ti64CLi++ » 28 Aoû 2021, 09:32

Oh yeah right, I had forgotten about the subdirectories ^^
Image
Avatar de l’utilisateur
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Prochain niv.: 32.3%
 
Messages: 3441
Images: 75
Inscription: 04 Juil 2014, 14:40
Localisation: Clermont-Ferrand 63
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: ENS Rennes
GitHub: Ti64CLi


Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 7 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
962 utilisateurs:
>945 invités
>12 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)