Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经使用 MacPorts 安装了 pHash 库,但是当我尝试编译示例源代码时出现此错误:
Fatal error: 'pHash.h' file not found #include "pHash.h"
如何告诉源代码在哪里可以找到库?(根据我发现它们安装在 /opt/local 中)
MacPorts 将东西安装到其中/opt/local,因此这些头文件将位于/opt/local/include,就编译器而言,这是一个非标准目录。
/opt/local
/opt/local/include
您将需要传递-I/opt/local/include给编译器。你如何做到这一点取决于你的构建系统,但是makeXcode 都支持它。
-I/opt/local/include
make
您很可能也需要传递-L/opt/local/lib给链接器...
-L/opt/local/lib