回覆列表
  • 1 # YAO大神

    在windows中使用make使用dev-cpp來構建環境是很方便的。

    下載安裝dev-cpp在環境變數中新增dev-cpp的安裝路徑就可以自己編寫makefile檔案在dos模擬終端運行了。

    dev-cpp自動生成的makefile檔案如下:

    # Project: BinaryTree

    # Makefile created by Dev-C++ 4.9.9.2

    CPP = g++.exe

    CC = gcc.exe

    WINDRES = windres.exe

    RES =

    OBJ = main.o $(RES)

    LINKOBJ = main.o $(RES)

    LIBS = -L"C:/Program Files/DEV-CPP/Lib"

    INCS = -I"C:/Program Files/DEV-CPP/include"

    CXXINCS = -I"C:/Program Files/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/backward" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2" -I"C:/Program Files/DEV-CPP/include"

    BIN = BinaryTree.exe

    CXXFLAGS = $(CXXINCS)

    CFLAGS = $(INCS)

    RM = rm -f

    .PHONY: all all-before all-after clean clean-custom

    all: all-before BinaryTree.exe all-after

    clean: clean-custom

    ${RM} $(OBJ) $(BIN)

    $(BIN): $(OBJ)

    $(CC) $(LINKOBJ) -o "BinaryTree.exe" $(LIBS)

    main.o: main.c

    $(CC) -c main.c -o main.o $(CFLAGS)

    改進

    # Project: BinaryTree

    # Makefile created by Dev-C++ 4.9.9.2

    CPP = g++.exe

    CC = gcc.exe

    WINDRES = windres.exe

    BIN = ScanfTest.exe

    RES =

    SRC += ScanfTest.c

    OBJ = $(SRC:.c=.o) $(RES)

    LINKOBJ = $(OBJ) $(RES)

    LIBS = -L"C:/Program Files/DEV-CPP/Lib"

    INCS = -I"C:/Program Files/DEV-CPP/include"

    CXXINCS = -I"C:/Program Files/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/backward" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2" -I"C:/Program Files/DEV-CPP/include"

    CXXFLAGS = $(CXXINCS)

    CFLAGS = $(INCS)

    RM = rm -f

    .PHONY: all all-before all-after clean clean-custom

    all: all-before $(BIN) all-after

    clean: clean-custom

    ${RM} $(OBJ) $(BIN)

    $(BIN): $(OBJ)

    $(CC) $(LINKOBJ) -o $(BIN) $(LIBS)

  • 中秋節和大豐收的關聯?
  • 私房錢和零花錢的區別是什麼?女人和男人對此都有什麼不同的看法?