The Makefile
You will need a "Makefile" so that you can compile your program.
Just download a copy of the Makefile into your cppTutorials
directory.
Testing the Makefile:
1) Create a file named test.cpp with your favorite editor (I like
emacs).
For example, I would use the following command:
> emacs test.cpp
and put the following inside the file:
//------My First C++ program------------
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
}
//--------------------------------------
2) Save the file and exit the editor.
3) Compile the program using the make program that reads the file
"Makefile":
> make
This is what I get when I run the above command:
-------------------------
mike ~/cppTutorials> make
/usr/bin/ar rc libutil.a
/usr/bin/ranlib libutil.a
g++ -O2 -DLinux -I. -c test.cpp
g++ -O2 -fno-automatic -finit-local-zero -ffixed-line-length-none
-fno-second-underscore \
test.o -I. -L. -o ./test
mike ~/cppTutorials>
-------------------------
4) Test the program:
> ./test
This is what I get when I run the above command:
-------------------------
mike ~/cppTutorials> ./test
Hello World!
mike ~/cppTutorials>
-------------------------