c++ - 如何使用 qmake 将 pcl 库成功添加到 qt 项目中
问题描述
我正在尝试使用 qmake 将 pcl 库包含到我的 qt 应用程序项目中。我发现了一些类似的问题,但是没有一个答案有助于解决我的问题。
我试图将来自 pcl lib 的路径以及 pcl 使用的 3rd 方库添加到 .pro 文件中。这是我的 .pro 文件的包含行。
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/lib
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Eigen/bin
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Boost/lib
INCLUDEPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
DEPENDPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
在那之后,我只是想把这个包含到我的一个文件中:
include pcl/io/pcd_io.h
这些是我回来的错误:
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:604:错误:无法使用 'const char [2] 找到字符串文字运算符 'operator""X' ', 'long long unsigned int' 参数 EIGEN_ASM_COMMENT("mybegin2");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:640:错误:无法使用 'const char [2] 找到字符串文字运算符 'operator""X' ', 'long long unsigned int' 参数 EIGEN_ASM_COMMENT("myend");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:644:错误:无法使用 'const char [2] 找到字符串文字运算符 'operator""X' ', 'long long unsigned int' 参数 EIGEN_ASM_COMMENT("mybegin4");
你能帮我解决这个问题吗?
解决方案
我建议使用CMake
. 请参阅以下链接:
- 这是 PointCloudLibrary 提供的两个示例
CMake
:qt_colorize_cloud和qt_visualizer。 - 以下是 中的配置说明
Qt
。
CMakeList.txt
如下:
cmake_minimum_required(VERSION 2.8.11)
project(pcl_visualizer)
# init_qt: Let's do the CMake job for us
set(CMAKE_AUTOMOC ON) # For meta object compiler
set(CMAKE_AUTORCC ON) # Resource files
set(CMAKE_AUTOUIC ON) # UI files
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Find the QtWidgets library
find_package(Qt5 REQUIRED Widgets)
find_package(VTK REQUIRED)
find_package(PCL 1.7.1 REQUIRED)
# Fix a compilation bug under ubuntu 16.04 (Xenial)
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(project_SOURCES main.cpp pclviewer.cpp)
add_executable(${PROJECT_NAME} ${project_SOURCES})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} Qt5::Widgets)
希望它会帮助你。
推荐阅读
- android - TextInput EditText android 不工作或无法插入任何值
- javascript - HackerRank 中的生日蛋糕蜡烛(简单的循环问题)
- python - 当我使用多重选择(easygui)选择多个行名时,不清楚如何将整个行发送到同一个 csv(附加)。单打效果不错
- android-studio - 在 Java (Android Studio) 中从 Activity 转换为 Fragment 时,Bottom_nav_menu 消失
- apache-nifi - 如何使 jsonpath 为名称-值对工作
- mongodb - 未处理的拒绝 Mongo 错误:在运行 mocha 测试时获取 addrinfo ENOTFOUND
- pandas - 我想知道使用熊猫的唯一类别编号
- node.js - 我可以使用 Express 创建客户端应用程序吗?
- c# - 如何使用 mysql 启用实体框架?
- ember.js - Ember Octane Glimmer 组件 @actions 是如何调用的?