基本上我试图弄清楚编译器为什么会抱怨缺少glew库:
有人能解释一下为什么上述设置是错误的/损坏的吗?
附注:操作系统为El Capitan。
fatal error: 'GL/glew.h' file not found
我的设置:
brew列表:
glew
glfw
glm
在 /usr/local/include 目录中:
GL -> ../Cellar/glew/2.0.0/include/GL
GLFW -> ../Cellar/glfw/3.2.1/include/GLFW
glm -> ../Cellar/glm/0.9.8.3/include/glm
还有Makefile:
# OBJS specifies which files to compile as part of the project
OBJS = *.cpp
# CC specifies which compiler we're using
CC = g++
# INCLUDE_PATHS specifies the additional include paths we'll need
INCLUDE_PATHS = -I/usr/local/include -I/opt/X11/include
# LIBRARY_PATHS specifies the additional library paths we'll need
LIBRARY_PATHS = -L/usr/local/lib -I/opt/X11/lib
# COMPILER_FLAGS specifies the additional compilation options we're using
# -w suppresses all warnings
COMPILER_FLAGS = -w
# LINKER_FLAGS specifies the libraries we're linking against
# Cocoa, IOKit, and CoreVideo are needed for static GLFW3.
LINKER_FLAGS = -framework OpenGL -lglfw3 -lglew
# OBJ_NAME specifies the name of our exectuable
OBJ_NAME = main
#This is the target that compiles our executable
all : $(OBJS)
$(CC) $(OBJS) $(INCLUDE_PATHS) $(LIBRARY_PATHS) $(COMPILER_FLAGS) $(LINKER_FLAGS) -o $(OBJ_NAME)
当我在同一目录下有一个名为: File.cpp 的文件并运行:
make File
i get:
fatal error: 'GL/glew.h' file not found
有人能解释一下为什么上述设置是错误的/损坏的吗?
附注:操作系统为El Capitan。
make File
: 在这里,您正在尝试制作一个在makefile中没有配方的目标,并对make
回退到的内置配方感到困惑。此makefile还存在许多问题。最好学习使用GNU Make和GCC的基础知识。这是一个相当不错的初学者教程。有关权威文档,请参阅GNU Make手册,以及GCC手册。 - Mike Kinghan#include<GL/glew.h>
可以更改。 - Mote ZartFLAGS:=$(shell pkg-config --libs --static --cflags-only-I glew glfw3)
- just_a_dude