PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10.01k stars 4.62k forks source link

[compile error] voxel_grid_occlusion_estimation.cpp.obj : error LNK2001 "class vtkRenderWindowInteractor * __cdecl vtkRenderWindowInteractorFixNew(void)" #5923

Closed zhangbin0917 closed 10 months ago

zhangbin0917 commented 10 months ago

Describe the error

Please paste the compilation results/errors.

To Reproduce

cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=D:\Softwares\3rdLib\pcl-1.14.0\install -DCMAKE_CUDA_ARCHITECTURES=native -DBOOST_ROOT=D:\Softwares\3rdLib\boost_1_84_0-msvc-14.3-64 -DBoost_DIR=D:\Softwares\3rdLib\boost_1_84_0-msvc-14.3-64 -DBOOST_INCLUDEDIR=D:\Softwares\3rdLib\boost_1_84_0-msvc-14.3-64\boost -DEigen3_DIR=D:\Softwares\3rdLib\vcpkg\installed\x64-windows\share\eigen3 -DFLANN_ROOT=D:\Softwares\3rdLib\vcpkg\packages\flann_x64-windows -Dlz4_DIR=D:\Softwares\3rdLib\vcpkg\packages\lz4_x64-windows\share\lz4 -DQt5_DIR=D:\Softwares\3rdLib\QT\QT-5.15.2\msvc2019_64\lib\cmake\Qt5 -DVTK_DIR=D:\Softwares\3rdLib\VTK-9.3.0\install\lib\cmake\vtk-9.3 Screenshots/Code snippets/Build information

[1/1] Linking CXX executable bin\pcl_voxel_grid_occlusion_estimation.exe
FAILED: bin/pcl_voxel_grid_occlusion_estimation.exe
C:\windows\system32\cmd.exe /C "cd . && C:\Softwares\cmake\bin\cmake.exe -E vs_link_exe --intdir=tools\CMakeFiles\pcl_voxel_grid_occlusion_estimation.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\pcl_voxel_grid_occlusion_estimation.rsp  /out:bin\pcl_voxel_grid_occlusion_estimation.exe /implib:lib\pcl_voxel_grid_occlusion_estimation.lib /pdb:bin\pcl_voxel_grid_occlusion_estimation.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /LTCG /subsystem:console  && cd ."
LINK: command "C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\pcl_voxel_grid_occlusion_estimation.rsp /out:bin\pcl_voxel_grid_occlusion_estimation.exe /implib:lib\pcl_voxel_grid_occlusion_estimation.lib /pdb:bin\pcl_voxel_grid_occlusion_estimation.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /LTCG /subsystem:console /MANIFEST:EMBED,ID=1" failed (exit code 1120) with the following output:
voxel_grid_occlusion_estimation.cpp.obj : error LNK2001: 无法解析的外部符号 "class vtkRenderWindowInteractor * __cdecl vtkRenderWindowInteractorFixNew(void)" (?vtkRenderWindowInteractorFixNew@@YAPEAVvtkRenderWindowInteractor@@XZ)
bin\pcl_voxel_grid_occlusion_estimation.exe : fatal error LNK1120: 1 个无法解析的外部命令
ninja: build stopped: subcommand failed.

Your Environment (please complete the following information):

mvieth commented 10 months ago

Thanks for reporting. You can fix this with the following patch:

diff --git a/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h b/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
index b427e76d9..7958f80e6 100644
--- a/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
+++ b/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
@@ -38,5 +38,6 @@
 #pragma once

 #include <vtkRenderWindowInteractor.h>
+#include <pcl/pcl_exports.h>

-vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew ();
+PCL_EXPORTS vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew ();
UnaNancyOwen commented 10 months ago

Thanks for reporting. You can fix this with the following patch:

diff --git a/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h b/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
index b427e76d9..7958f80e6 100644
--- a/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
+++ b/visualization/include/pcl/visualization/vtk/vtkRenderWindowInteractorFix.h
@@ -38,5 +38,6 @@
 #pragma once

 #include <vtkRenderWindowInteractor.h>
+#include <pcl/pcl_exports.h>

-vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew ();
+PCL_EXPORTS vtkRenderWindowInteractor* vtkRenderWindowInteractorFixNew ();

@mvieth I have confirmed that this issue is reproduced, and your patch will solve this error. Please sent pull-request. Thanks! 👍