如何使用qmake

时间:2019-05-31 08:59:31

标签: c++ qt qmake point-cloud-library

我正在尝试使用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放到我的一个文件中:

include pcl/io/pcd_io.h

这些是我回来的错误:

  

D:\ Libraries \ PCL_1.6.0 \ 3rdParty \ Eigen \ include \ Eigen \ src \ Core \ products \ GeneralBlockPanelKernel.h:604:错误:无法找到带有'const char'的字符串文字运算符'operator“” X“ [2],'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的字符串文字运算符'operator“” X“ [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:错误:无法找到带有'const char的字符串文字运算符'operator“” X“ [2],'long long unsigned int'参数    EIGEN_ASM_COMMENT(“ mybegin4”);

您能帮我解决问题吗?

1 个答案:

答案 0 :(得分:1)

我建议使用CMake。请参阅以下链接:

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)

希望它会对您有所帮助。