I usually use Visual Studio for c/c++ programming, however I want to give vscode a shot and I don't know how to include libraries using Makefile. (The tutorials on youtube didn't work) I tried using C/C++ Configurations (IntelliSense Configurations) but doesn't work.
I want to include GLFW and GLAD.
Project Library Paths: C:\Users\Administrator\Documents\Game Project\include\GLAD and C:\Users\Administrator\Documents\Game Project\include\GLFW
The Makefile:
all:
g++ -g --std=c++20 -I../include -L../lib ../src/*.cpp ../src/glad.c -lglfw3dll -o main
(Got this from the youtube tutorial)
It always gives me the "No such file or directory" error.
Please help
If your include directory is
C:\Users\Administrator\Documents\Game Project\include\GLFW
in that it is this directory that contains your header files, then the-I
should end inGLFW
because that is the directory your headers are in. The same applies to the-L
switch.Your command line should look something like
You can have multiple
-I
switches for multiple directories (as you have here) and the same for-L
.I was guessing above that the libraries are in subdirectories like the headers, btw. But the rule is the same as for headers: The
-L
path(s) must point to the directory containing the libraries, not any parent of that directory.