Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make/cc not finding header file even though its directory is present in PATH variable

I am trying to run Allegro on my mac but I keep getting

main.cpp:1:10: fatal error:'allegro5/allegro.h' file not found

error.

I have installed allegro successfully and I can find the header files in /usr/local/include/allegro5 . I added a path to my environment variable and when I do echo $PATH I can see /usr/local/include. In the sample program I am trying to run the include is like this -

#include <allegro5/allegro.h>

and I run-

make main

I can see the header files I have included, why isn't mac able to find the files present in that path?

like image 884
Ashwin Avatar asked Jan 26 '26 14:01

Ashwin


1 Answers

As @PaulR mentioned, PATH is where the shell looks for commands, not for where the compiler looks for includes. You could also add the -I/usr/local/include option to your command line as a way to resolve it.

You could check C_INCLUDE_PATH or CPLUS_INCLUDE_PATH or INCLUDE_PATH (not sure which it's looking for).

like image 62
Michaël Le Barbier Avatar answered Jan 28 '26 02:01

Michaël Le Barbier