Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Arrays

How do I compile an array using gnu ?

14th Apr 2018, 8:37 PM
Thizwilondi Nembahe
Thizwilondi Nembahe - avatar
2 Answers
+ 2
g++ your_file.cpp Where your_file.cpp contains code doing something with an array.
14th Apr 2018, 10:17 PM
Emma
+ 1
I recommend: g++ code.cpp -Wall -o code && ./code Where "code" is the program name. It will compile and run like an IDE then. To automate this you could save this script: #! /bin/sh g++ $1 -Wall -o $(echo $1 | sed 's/.cpp//') && ./$(echo $1 | sed 's/.cpp//') Save that as say "compile", then do "chmod +x compile". Now you can type: ./compile file.cpp to compile and run the file. PS: I know the script was a little messy \_O_/
15th Apr 2018, 12:04 AM
non