Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC not finding header files in /usr/local/include

I've recently installed libechonest and all its dependencies, yet to include its header files (in /usr/local/include/echonest/ I have to specify the whole path, i.e. #include "/usr/local/include/echonest/Artist.h" instead of just #include <Artist.h>:

alexcannon$ gcc -g -o geoEchoNest geoEchoNest.c -lechonest
geoEchoNest.c:6:10: fatal error: 'Artist.h' file not found
#include "Artist.h"

Why is this? According to the GCC docs it should look in /usr/local/include by default:

GCC looks in several different places for headers. On a normal Unix system, if you do not >instruct it otherwise, it will look for headers requested with #include in:

/usr/local/include
libdir/gcc/target/version/include
/usr/target/include
/usr/include

How can I fix it? I have the same problem for other libraries, e.g. I have to do #include "/usr/local/include/QtCore/QDebug" instead of include <QDebug> so it's not just an echonest issue.

Permissions for /usr/local/include are drwxrwxr-x. Here is my gcc info:

alexcannon$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-    include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

I searched and found lots of similar #include GCC questions, but the only one specifically dealing with issues finding files in /usr/local/include was specific to XCode.

Obviously let me know if you need any more info and as always thanks in advance for the help.

like image 558
acannon828 Avatar asked Sep 14 '25 13:09

acannon828


1 Answers

The include path is not searched recursively, try this.

#include <echonest/Artist.h>
like image 77
Gary Avatar answered Sep 17 '25 04:09

Gary