Windows 7 使用CMakeLists文件使用QtCreator编译PCL代码示例
我正试图用QtCreator编译一个PCL示例,使用一个CMakeLists.txt文件。FindPCL.cmake文件(从此处获取:)与源文件位于同一目录中 我的CMakeLists.txt文件是: 我试图编译的代码如下:Windows 7 使用CMakeLists文件使用QtCreator编译PCL代码示例,windows-7,cmake,qt-creator,point-cloud-library,Windows 7,Cmake,Qt Creator,Point Cloud Library,我正试图用QtCreator编译一个PCL示例,使用一个CMakeLists.txt文件。FindPCL.cmake文件(从此处获取:)与源文件位于同一目录中 我的CMakeLists.txt文件是: 我试图编译的代码如下: #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> #include <iostream> int main(int argc, char* argv[]) { pcl:
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <iostream>
int main(int argc, char* argv[]) {
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
{
std::cout << "Nope\n";
return (-1);
}
std::cout << "Loaded " << cloud->width * cloud->height << " data points from test_pcd.pcd with the following fields: " << std::endl;
for (size_t i = 0; i < cloud->points.size (); ++i)
std::cout << " " << cloud->points[i].x << " " << cloud->points[i].y << " " << cloud->points[i].z << std::endl;
return (0);
}
有什么想法吗?
提前谢谢
PS:在CmakeList文件中,我将CMAKE_模块_路径
指向CMAKE二进制文件的目录。是这样吗
PS2:我正在使用MingW编译器
PS3:Windows 7 64位也是如此。您应该将
CMAKE_MODULE_PATH
设置到包含FindPCL.CMAKE
的目录中。如果此目录是模块的标准CMake目录(share/CMake/modules
),则根本不需要此目录
因此,将
CMAKE\u模块路径设置为bin/
dir是错误的。whoooooops,忘记了!!。我来编辑这篇文章!。谢谢另外,我使用的编译器是MingW。我已经在帖子中添加了这些信息。你得到正确答案了吗?@Yeahpping抱歉?我也遇到了这个问题。你好,谢谢你的回复。FindPCl.cmake
位于另一个目录(PCL1.5.1/cmake)中。所以我尝试了:list(附加CMAKE\u模块路径“E:/LIBRERIAS/PCL1.5.1/CMAKE”)
,但失败了,出现了相同的错误。然后我尝试将列表(APPEND…
行更改为集(CMAKE\u模块路径“E:/LIBRERIAS/PCL1.5.1/CMAKE”)
,再次失败。此外,注释或取消注释集合(PCL_DIR…
行并不重要,它再次失败:(在find\u package()之前尝试set(CMAKE\u PREFIX\u PATH E:/LIBRERIAS/PCL1.5.1/CMAKE)
call.Nope,同样的错误。我应该删除列表(附加CMAKE\u模块路径“E:/SITEGI/LIBRERIAS/PCL1.5.1/CMAKE”)
,设置(PCL\u ROOT“E:/SITEGI/LIBRERIAS/PCL1.5.1”)
还是设置(PCL\LIBRERIAS-DIR/PCL.5.1”)
先从文件中删除行?。
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <iostream>
int main(int argc, char* argv[]) {
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test_pcd.pcd", *cloud) == -1) //* load the file
{
std::cout << "Nope\n";
return (-1);
}
std::cout << "Loaded " << cloud->width * cloud->height << " data points from test_pcd.pcd with the following fields: " << std::endl;
for (size_t i = 0; i < cloud->points.size (); ++i)
std::cout << " " << cloud->points[i].x << " " << cloud->points[i].y << " " << cloud->points[i].z << std::endl;
return (0);
}
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "FindPCL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "PCL", but
CMake did not find one.
Could not find a package configuration file provided by "PCL" (requested
version 1.5.1) with any of the following names:
PCLConfig.cmake
pcl-config.cmake
Add the installation prefix of "PCL" to CMAKE_PREFIX_PATH or set "PCL_DIR"
to a directory containing one of the above files. If "PCL" provides a
separate development package or SDK, be sure it has been installed.