简体   繁体   中英

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM