Create folder test in home diretory
Use vim to create test.cpp and makefile
Contents of test.cpp
#test.cpp
#include
using namespace std;
int main(int argc, char *argv[])
{
cout<<"Hello World!\n" ;
return;
}
Contents of makefile
CC = g++
CFLAGS = -Wall
LDFLAGS=
SOURCES := test.cpp
OBJS := $(SOURCES:.cpp =.o)
test : $(OBJS)
$(CC) $(CFLAGS) -o test $(OBJS) $(LDFLAGS) $(LIBS)
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $<
clean:
rm *.o temp
Now just run make from command prompt. First binary is ready!!!
I recommend to go through beginner turtrial about makefile.
No comments:
Post a Comment