I am trying to create a project using GLFW3 while compiling on mingw for windows and I am getting the following error:
C:\Users\jgelderl\Documents\Test>mingw32-make
g++ -c Main.cpp
Main.cpp:6:24: fatal error: GLFW/glfw3.h: No such file or directory
#include <GLFW/glfw3.h>
Here is the makefile that I am using:
CC = g++
OUT_EXE = Main.exe
OUT_EXE_TEST = Test.exe
LINK_FLAGS = -L"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" -lWinMM -L"C:\glfw-3.0.4.bin.WIN32\lib-mingw" -lglfw3 -lopengl32 -lglu32 -lgdi32
INC_ DIRS = -I"C:\glfw-3.0.4.bin.WIN32\include"
CFLAGS = -c
all: Main.exe
Main.exe: Main.o game.o Block.o Board.o
$(CC) -o Main.exe $(INC_DIRS) Main.o game.o Block.o Board.o $(LINK_FLAGS)
test: Test.exe
Test.exe: Test.o game.o Block.o Board.o
$(CC) -o Test.exe Test.o game.o Block.o Board.o $(LINK_FLAGS)
Main.o: Main.cpp
$(CC) $(CFLAGS) Main.cpp
game.o: game.cpp game.h
$(CC) $(CFLAGS) game.cpp
Block.o: Block.cpp Block.h
$(CC) $(CFLAGS) Block.cpp
Board.o: Board.cpp Board.h
$(CC) $(CFLAGS) Board.cpp
Test.o: Test.cpp greatest.h
$(CC) $(CFLAGS) Test.cpp
clean:
rm Main.exe Test.exe *.o
rebuild: clean all
I am not super experienced with makefiles but I am trying to use it to learn more about the build process. I have also put the GLFW library and include files in the mingw directories but that has not helped either. Am I doing something wrong in my makefile or do I maybe have something else set up incorrectly?
The problem was that the include directory was not being used to build each object.
Original:
CFLAGS = -c
New:
CFLAGS = -c $(INC_DIRS)
This change fixed the problem.