Monday, January 30, 2012

Script - Done!

Okay, so, I asked the professor past week about creating a script for automatically compiling a C++ source code and linking it and he told me to just press the up arrow on my keyboard until I find the command on my terminal. Thing is, I'm too lazy to do that. I prefer to just type 5 symbols to get everything compiled and linked. So, here's the simple script I needed:

 echo "Compiling the C++ source code..."
 g++ -Wall -c SourceCode.cpp
 echo "Compilation done"
 echo "Now linking..."
 g++ -o Executable SourceCode.o
 echo "Done" 

Note to self: I'm "echoing" stuff because the g++ commands do not appear in the terminal window when running the script. I just want to know what the script is doing when I run it. And I hope compiler errors show up if anything happens.

No comments:

Post a Comment