如何使用 qmake 将 pcl 库成功添加到 qt 项目中
How to add successfully pcl library to a qt project with qmake
我正在尝试使用 qMake,将 PCL 库包含在我的 Qt 应用程序项目中。我发现了一些类似的问题,但是没有一个答案有助于解决我的问题。
我试图将来自 pcl lib 的路径以及 pcl 使用的第三方库添加到 .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:错误:找不到字符串文字运算符"运算符"X",带有"const char [2]","long long unsigned int"参数 EIGEN_ASM_COMMENT("我的开始2");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:640:错误:找不到字符串文字运算符"运算符"X",带有"const char [2]","long long unsigned int"参数 EIGEN_ASM_COMMENT("myend");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:644:错误:找不到字符串文字运算符"运算符"X"与"const char [2]","long long unsigned int"参数 EIGEN_ASM_COMMENT("我的开始4");
你能帮我解决问题吗?
我建议使用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)
希望对您有所帮助。
- QT通过C++添加映射QML项目
- 如何将点击的信号和插槽添加到qt中的自定义按钮中
- Qt和C++:将QLineEdit添加到QTabWidget中
- 如何在qt中将对象添加到现有布局中?--已解决
- 如何将网络模块添加到 QT pro 文件中?
- Qt:无法直接为带有子项的小部件添加滚动条
- Qt - 为什么Visual Studio 2019在qml资源中添加10Mb文件后无法再编译我的项目?
- 如何在Qt C++中向自定义控件添加属性?
- 如何在Qt中合并/追加/添加两个用于线程的模型?
- 替换为单个黑斜杠在Qt中添加"
- 在QT中为小部件添加彩色边框的最佳方法是什么
- 添加qt-libs后出现编译错误
- 如何将ICU库添加到ARM的Qt项目中
- QT:添加到QMenu后,谁是QActionGroup成员的父级
- 如何在Qt pro文件中添加导出路径
- 如何在OSX应用程序的标题栏中添加Qt中的全屏图标
- 如何在项目生成文件中添加 Qt 类
- 在运行时向主窗口添加Qt小部件
- 在QMain窗口上添加QT布局的代码
- 工作与现有的c++代码测试下的谷歌测试和添加Qt