suppose i have mainprog.cpp that uses program.h.
how do i create a makefile and how do i run it?
suppose i have mainprog.cpp that uses program.h.
how do i create a makefile and how do i run it?
Something like
Note the indent before each $CXX is a real tab character, not spaces. This will catch you out.Code:mainprog.o : mainprog.cpp program.h $(CXX) -c mainprog.cpp prog : mainprog.o $(CXX) -o prog mainprog.o
You save this file as Makefile, and you run it by typing make at the command line prompt.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.