-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[compile error] link error #5487
Comments
Try adding |
This is my source code. I added # define PCL at the top of the code_ NO_ PRECOMPILE, but other errors occurred `// lidar 2 lidar calibration #define PCL_NO_PRECOMPILE #include #include <Eigen/Core> #include <pcl/point_cloud.h> #include <pcl/kdtree/kdtree_flann.h> #include <pcl/visualization/pcl_visualizer.h> #include <pcl/features/normal_3d_omp.h> #include <pcl/filters/statistical_outlier_removal.h> #include <pcl/registration/transformation_estimation_svd.h> typedef pcl::PointNormal PointXYZN; typedef pcl::PointXYZINormal PointT; void icp_match(const PointCloudPtr& src, const PointCloudPtr& base, Eigen::Matrix4d &trans) { norm_est.setNumberOfThreads(8); norm_est.setInputCloud(src); pcl::IterativeClosestPointWithNormals<PointT, PointT, float> icp; std::cout<<"source points size "<size()<<std::endl; icp.setMaxCorrespondenceDistance(5.0); PointCloudPtr src_registered(new PointCloud); icp.align(*src_registered, init_pose); std::cout<<"align icp final"<<std::endl; if (icp.hasConverged()) {
} void lidar2lidarCalibration(const std::string& path1, const std::string& path2) std::vector indices; pcl::VoxelGridpcl::PointXYZINormal filter; pcl::StatisticalOutlierRemovalpcl::PointXYZINormal sor; sor.setInputCloud(source_pts); sor.setInputCloud(target_pts); std::cout<<"load pcd"<<std::endl; Eigen::Matrix4d tran_mat_icp; tran_mat_icp.setIdentity(); icp_match(source_pts, target_pts, tran_mat_icp); std::cout<<"the calibration result is "<<std::endl<<tran_mat_icp<<std::endl; PointCloudPtr transed_cloud(new PointCloud); pcl::visualization::PCLVisualizer::Ptr viewer(new pcl::visualization::PCLVisualizer("trans_viewer")); pcl::visualization::PointCloudColorHandlerCustom source_color_handle(target_pts, 255, 0, 0); viewer->addPointCloud(target_pts, source_color_handle, "source"); viewer->spin(); |
These errors come from the FLANN library, a dependency of PCL. The all-in-one installer includes the latest version of FLANN. Also, it might be better to use #define PCL_NO_PRECOMPILE
#include <pcl/features/normal_3d_omp.h>
#undef PCL_NO_PRECOMPILE (same for other headers where you get link errors). #undef PCL_NO_PRECOMPILE
#include <pcl/kdtree/kdtree_flann.h>
#define PCL_NO_PRECOMPILE |
These settings have been generated in qt cmakelists.txt,set(CMAKE_CXX_STANDARD 17),It should be based on the C++17 standard,But my problem still exists cmake_minimum_required(VERSION 3.5) project(zxtx_autocar VERSION 0.1 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOUIC ON) set(CMAKE_CXX_STANDARD 17) |
Okay, so would it be an option to change it to |
#undef PCL_ NO_ PRECOMPILE There are no compilation errors, but there are cmake errors D:\Program Files (x86)\PCL 1.12.1\cmake\PCLConfig.cmake:59: error: visualization is required but vtk was not found D:/Program Files (x86)/PCL 1.12.1/cmake/PCLConfig.cmake:353 (pcl_report_not_found) D:/Program Files (x86)/PCL 1.12.1/cmake/PCLConfig.cmake:540 (find_external_library) CMakeLists.txt:57 (find_package) |
Have you tried setting |
how did you solve this problem? |
Operating environment in windows11
qt5.15.2+pcl1.12.1+vtk9.1
vtk9.1 Compile with cmake+vs2022
Qt compiles using cmake
PCL is installed using PCL-1.12.1-AllInOne-msvc2019-win64.exe
QT CMakeLists.txt
set(PCL_DIR "D:/Program Files (x86)/PCL 1.12.1/cmake")
find_package(PCL 1.12 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(FLANN_ROOT "D:/Program Files (x86)/PCL 1.12.1/3rdParty/FLANN")
set(FLANN_INCLUDE_DIRS "D:/Program Files (x86)/PCL 1.12.1/3rdParty/FLANN/include")
set(FLANN_LIBRARY_DIRS "D:/Program Files (x86)/PCL 1.12.1/3rdParty/FLANN/lib")
include_directories(${FLANN_INCLUDE_DIRS})
link_directories(${FLANN_LIBRARY_DIRS})
target_link_libraries(zxtx_autocar PRIVATE ${PCL_LIBRARIES})
Compilation Error
lidar2lidar.cpp.obj:-1: error: LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl pcl::NormalEstimation<struct pcl::PointXYZINormal,struct pcl::PointXYZINormal>::computeFeature(class pcl::PointCloud &)" (?computeFeature@?$NormalEstimation@UPointXYZINormal@pcl@@U12@@pcl@@MEAAXAEAV?$PointCloud@UPointXYZINormal@pcl@@@2@@z)
lidar2lidar.cpp.obj:-1: error: LNK2019: 无法解析的外部符号 "public: void __cdecl pcl::NormalEstimationOMP<struct pcl::PointXYZINormal,struct pcl::PointXYZINormal>::setNumberOfThreads(unsigned int)" (?setNumberOfThreads@?$NormalEstimationOMP@UPointXYZINormal@pcl@@U12@@pcl@@QEAAXI@Z),函数 "void __cdecl icp_match(class std::shared_ptr<class pcl::PointCloud > const &,class std::shared_ptr<class pcl::PointCloud > const &,class Eigen::Matrix<double,4,4,0,4,4> &)" (?icp_match@@YAXAEBV?$shared_ptr@V?$PointCloud@UPointXYZINormal@pcl@@@pcl@@@std@@0AEAV?$Matrix@N$03$03$0A@$03$03@Eigen@@@z) 中引用了该符号
lidar2lidar.cpp.obj:-1: error: LNK2001: 无法解析的外部符号 "private: virtual void __cdecl pcl::NormalEstimationOMP<struct pcl::PointXYZINormal,struct pcl::PointXYZINormal>::computeFeature(class pcl::PointCloud &)" (?computeFeature@?$NormalEstimationOMP@UPointXYZINormal@pcl@@U12@@pcl@@EEAAXAEAV?$PointCloud@UPointXYZINormal@pcl@@@2@@z)
lidar2lidar.cpp.obj:-1: error: LNK2019: 无法解析的外部符号 "public: __cdecl pcl::visualization::PointCloudGeometryHandlerXYZ::PointCloudGeometryHandlerXYZ(class std::shared_ptr<class pcl::PointCloud const > const &)" (??0?$PointCloudGeometryHandlerXYZ@UPointXYZINormal@pcl@@@visualization@pcl@@qeaa@AEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZINormal@pcl@@@pcl@@@std@@@z),函数 "public: bool __cdecl pcl::visualization::PCLVisualizer::addPointCloud(class std::shared_ptr<class pcl::PointCloud const > const &,class pcl::visualization::PointCloudColorHandler const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int)" (??$addPointCloud@UPointXYZINormal@pcl@@@PCLVisualizer@visualization@pcl@@QEAA_NAEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZINormal@pcl@@@pcl@@@std@@aebv?$PointCloudColorHandler@UPointXYZINormal@pcl@@@12@AEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@4@H@Z) 中引用了该符号
lidar2lidar.cpp.obj:-1: error: LNK2001: 无法解析的外部符号 "public: virtual void __cdecl pcl::visualization::PointCloudGeometryHandlerXYZ::getGeometry(class vtkSmartPointer &)const " (?getGeometry@?$PointCloudGeometryHandlerXYZ@UPointXYZINormal@pcl@@@visualization@pcl@@UEBAXAEAV?$vtkSmartPointer@VvtkPoints@@@@@z)
The text was updated successfully, but these errors were encountered: