grepNstepN grepNstepN - 10 days ago 6
C++ Question

OSX 10.11.6 Make cant find headers specified --include-dir not working

I'm attempting to compile code on OSX 10.11.6
The header file to use is in:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
i386/


So as a test, the c code incudes i386/_types.h thats located in [.../usr/include/i386/_types.h] so I used:

make --include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/


However, it still doesn't find the _types.h file under the i386 directory and throws an error stating file not found!

Answer

It turns out I should have used clang instead of g++, from there the library path argument had to be specified along with the framework e.g.

clang -stdc++ -framework