I’m trying to compile a C program (myProgram.c) that includes a custom .h file that is in a specified directory. How can I add the directory to gcc so that I can build myProgram.c anytime using just a command like gcc myProgram (with no flags and what not)
I’m trying to compile a C program (myProgram.c) that includes a custom .h file
Share
You can do this by altering the
C_INCLUDE_PATHenvironment variable, e.g.You can add that to your
.bashrcor.bash_profileor whatever to always have the environment variable set properly. Here’s a reference on how you can do the same for libraries and C++.