#include <iostream> int main() { std::cout << "My first program..." << std::endl; return 0; }
Linux
I created makefile which allows to compile and run application. To read more about how to create makefile you can read here.
CPP = g++ CFLAGS = -Wall -lrt all: program $(CPP) $(CFLAGS) -o bin/program obj/program.o program: $(CPP) $(CFLAGS) -o obj/program.o -c src/program.cpp clean: rm -f ./obj/*.o rm -f ./bin/program run: ./bin/programTo compile application just type make:
makeIf you want to run application, type such command:
make run
To compile application on Linux I used GNU C++ compiler (g++). The -Wall command line option enables all warnings. If you want to get more information about compiler read here.
Windows
I created .mak file which allows to compile and run application. To read more about how to create .mak file and use NMAKE utility you can read here.
CPP = cl CFLAGS = /EHsc /W4 all: program $(CPP) $(CFLAGS) /Febin/program.exe obj/program.obj program: $(CPP) $(CFLAGS) /c src/program.cpp /Foobj/ clean: del bin\*.exe obj\*.obj run: bin\program.exeTo compile application on Windows I used Microsoft C/C++ compiler (cl). The /EHsc command line option instructs the compiler to enable C++ exception handling. The /c command line option instructs the compiler to compile without linking. The /W command line option sets warning level. If you want to get more information about compiler read here.
To compile application, type such command:
nmake -f build.makTo run application, type such command:
nmake -f build.mak run
No comments:
Post a Comment