没有这样的文件或目录,只有file存在

No such file or directory but file exist

本文关键字:只有 file 存在 文件      更新时间:2023-10-16

我安装了pcl。在user/include/pcl-1.7下有一个pcl文件夹。我添加#include <pcl/ModelCoefficients.h>行到cpp文件。在终端上,我尝试编译这个文件。

g++ -c test.cpp 
fatal error: pcl/ModelCoefficients.h: No such file or directory
#include <pcl/ModelCoefficients.h>
                               ^
compilation terminated.

如何解决这个错误?

使用-I告诉编译器在user/include/plc-1.7路径中搜索头文件:

g++ -Iuser/include/plc-1.7 -c test.cpp 

更多信息:

  • https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
  • https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
相关文章: