I'm programming in C++ and I've already linked GLFW in the project, however, I can't figure out how to add GLEW to the project. I tried downloading it from their website but unzipping the folder gives me only the includes, nothing in the library folder. There is also only links for windows or the zip file however the website does state that it works on a mac.
The reason why I think there are supposed to have lib files is because in someone else's repo, in their dependencies folder, the subfolder lib has files for GLEW.
I'm also not sure how to update my Makefile to link GLEW into the project.
This is my Makefile and also a screen shot of how my files are stored right now.
CXX = g++
OUTPUT = app
CXX_FILES = $(wildcard ./src/*.cpp)
CXX_FLAGS = -Wall -g -std=c++17 -DGL_SILENCE_DEPRECATION
LIB_DIR = src/vendors/lib
INCLUDE_DIR = src/vendors/include
# Adjusting LDFLAGS
LDFLAGS = -lpthread -lglfw.3 -lGlew -framework Cocoa -framework OpenGL -framework IOKit
all: $(OUTPUT)
$(OUTPUT): $(CXX_FILES:.cpp=.o)
$(CXX) $(CXX_FLAGS) -o $@ $^ -L$(LIB_DIR) $(LDFLAGS) -Wl,-rpath,$(LIB_DIR)
%.o: %.cpp
$(CXX) $(CXX_FLAGS) -c -o $@ $< -I $(INCLUDE_DIR)
clean:
rm -f $(OUTPUT) $(CXX_FILES:.cpp=.o)
The glew-2.1.0.zip you downloaded comes with a README file. If you read it, you will see it contains the following simple build instructions:
Build
$ make
or, using CMake:
$ cd build
$ cmake ./cmake
$ make -j4
This generates various libGLEW*
files in lib
or build
. (for the CMake variant)
Since you're on a mac, brew install glew
is the superior option.