我想用makefile编译一个程序如下:
CC = g++
CFLAGS = -g -DGL_GLEXT_PROTOTYPES -I/example_01/glew -I/example_01/glfw-3.2.1 -Wno-deprecated-declarations
LDFLAGS = -lGL -lGLEW -glfw
RM = /bin/rm -f
all: main
main: example_01/src/example_01.o
$(CC) $(CFLAGS) -o as1 example_01/src/example_01.o $(LDFLAGS)
example_00/example_00.o: example_01/example_01.cpp
$(CC) $(CFLAGS) -c example_01/src/example_01.cpp -o example_01/src/example_01.o
clean:
$(RM) *.o example_01/src/*.o as1
但是有错误:
fatal error: GLFW/glfw3.h: No such file or directory
#include <GLFW/glfw3.h>
我的makefile位于
graphics/example_01
glfw-3.2.1和glew文件位于
graphics/example_01/example_01
glfw3.h位于
graphics/example_01/example_01/glfw-3.2.1/include/GLFW
example_01.cpp位于
graphics/example_01/example_01/src
那么如何编译?谢谢!
答案 0 :(得分:0)
您的包含目录错误。
CFLAGS = -g -DGL_GLEXT_PROTOTYPES -I/example_01/glew -I/example_01/glfw-3.2.1 -Wno-deprecated-declarations
您应该将-I/example_01/glfw-3.2.1
更改为-I/example_01/glfw-3.2.1/include
您可能需要对GLEW include目录进行类似的更改。