我正在将Qt5,VTK,PCL和PDAL编译成一个项目,我的构建过程非常有效,直到我重建PCL,因为我试图摆脱另一个奇怪的错误,在链接后语法错误在Qt5中不断出现PCL。有关详细信息,请参阅此处:Qt, VTK, PCL, and PDAL integration 我最近还同意在root下使用新的XCode许可证。所以这也可能是问题所在。这是确切的错误:
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/usr/bin/g++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -I/Users/wfehrnstrom/build-CmakeTest-MainKit-Release -I/Users/wfehrnstrom/CmakeTest -I/usr/local/include/vtk-7.0 -isystem /usr/local/include -iframework /Users/wfehrnstrom/Qt5/5.7/clang_64/lib -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtWidgets.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtGui.framework/Headers -isystem /System/Library/Frameworks/OpenGL.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/lib/QtCore.framework/Headers -isystem /Users/wfehrnstrom/Qt5/5.7/clang_64/./mkspecs/macx-clang -ferror-limit=0 -O3 -DNDEBUG vtkDomainsChemistry_AUTOINIT=1(vtkDomainsChemistryOpenGL2) vtkRenderingContext2D_AUTOINIT=1(vtkRenderingContextOpenGL2) vtkRenderingCore_AUTOINIT=3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL2) -fPIC -std=gnu++11 -o CMakeFiles/CmakeTest.dir/main.cpp.o -c /Users/wfehrnstrom/CmakeTest/main.cpp'
make[2]: *** [CMakeFiles/CmakeTest.dir/main.cpp.o] Error 2
make[1]: *** [CMakeFiles/CmakeTest.dir/all] Error 2
make: *** [all] Error 2
有谁知道为什么我在重建VTK和PCL后似乎无处可寻?谢谢!
答案 0 :(得分:1)
在OS X上将PCL拉入QT5时会出现同样的问题。
从源代码编译PCL 1.8解决了该问题(从PCL 1.6迁移)。
的CMakeLists.txt:
project(LRS_PCL)
set(CMAKE_C_COMPILER "/usr/bin/gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
cmake_minimum_required(VERSION 2.8)
set(SOURCE_DIR .)
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
PARENT_SCOPE
)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(CMAKE_PREFIX_PATH $ENV{HOME}/Qt/5.5/gcc_64)
find_package( PCL 1.8 REQUIRED )
find_package( Qt5 REQUIRED COMPONENTS Widgets Core )
include( CheckCXXCompilerFlag )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
include_directories( ${PCL_INCLUDE_DIRS} /user/local/include )
link_directories( ${PCL_LIBRARY_DIRS} /usr/local/lib /usr/lib/x86_64-linux-gnu )
add_definitions( ${PCL_DEFINITIONS} )
target_link_libraries( LRS_PCL ${PCL_LIBRARIES} /usr/local/lib/librealsense.so )