I mainly code in Python, but now I want to start to code in C++. In Python, you can just
import glfw # example
I want to do the same in C++. I know I can do it like this:
#include <glfw.h>
But then I have to use parameters in the compiler.
What I tried:
What I'm expecting:
g++ main.cpp
Welcome to C++. A complete answer goes down a rabbit hole, so I'll simplify.
The statement #include <glfw.h>
uses <>
, which technically means the header file is outside the local project. Typically, this means it is a library provided by the compiler distribution. It may be a third-party library you installed on your system.
If you use ""
, the compiler will search the same directory as your source file and then for the compiler or third-party files.
Nothing is needed on the command line for the compiler or local headers. A third-party library probably does need an -I indicating where the header is located. There are some variations to this, depending on the compiler and OS.