我有一个项目,可以在 unix 下使用手工制作的基本 makefile 进行编译,但不能在 windows 下使用 netbeans 或 code::blocks。这显然会使项目非常难以调试。我已经尝试使用我的手工制作文件代替自动生成的文件,但我仍然得到下面的错误列表。
In file included from Graph.h:7:0,
from main.cpp:9:
List.h:37:6: error: expected unqualified-id before ‘delete’
List.h:40:16: error: variable or field ‘printList’ declared void
List.h:40:16: error: ‘FILE’ was not declared in this scope
List.h:40:22: error: ‘out’ was not declared in this scope
List.h:40:32: error: expected primary-expression before ‘L’
我制作的makefile是:
BASE_SOURCES = Graph.c List.c
BASE_OBJECTS = Graph.o List.o
HEADERS = Graph.h List.h
COMPILE = gcc -c -std=c99 -Wall
LINK = gcc -o
REMOVE = rm -f
MEMCHECK = valgrind --leak-check=full
GraphClient : GraphClient.o $(BASE_OBJECTS)
$(LINK) GraphClient GraphClient.o $(BASE_OBJECTS)
FindPath.o : FindPath.c $(HEADERS)
$(COMPILE) FindPath.c
GraphClient.o : GraphClient.c $(HEADERS)
$(COMPILE) GraphClient.c
$(BASE_OBJECTS) : $(BASE_SOURCES) $(HEADERS)
$(COMPILE) $(BASE_SOURCES)
clean :
$(REMOVE) GraphClient GraphClient.o $(BASE_OBJECTS)
checkClient : GraphClient
$(MEMCHECK) GraphClient
如果有人愿意,我可以包含 netbeans 生成的 makefile,但我认为这并不重要,因为我的手工制作的也不能在 Windows 下工作。实际代码也一样,我认为这并不重要,因为它是在 unix 下编译的?