From 7f07c87204820def85e12ce68663384406e9aa9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Tue, 26 Mar 2024 09:48:51 -0400 Subject: [PATCH] fix pcl::squaredEuclideanDistance already defined in grabcut_2d.cpp.obj Detailed error message: FAILED: bin/pcl_grabcut_2d.exe C:\WINDOWS\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=apps\CMakeFiles\pcl_grabcut_2d.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\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe @CMakeFiles\pcl_grabcut_2d.rsp /out:bin\pcl_grabcut_2d.exe /implib:lib\pcl_grabcut_2d.lib /pdb:bin\pcl_grabcut_2d.pdb /version:0.0 /machine:x64 /nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF /subsystem:console && cd ." LINK: command "C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe @CMakeFiles\pcl_grabcut_2d.rsp /out:bin\pcl_grabcut_2d.exe /implib:lib\pcl_grabcut_2d.lib /pdb:bin\pcl_grabcut_2d.pdb /version:0.0 /machine:x64 /nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF /subsystem:console /MANIFEST:EMBED,ID=1" failed (exit code 1169) with the following output: pcl_segmentation.lib(grabcut_segmentation.cpp.obj) : error LNK2005: "float __cdecl pcl::squaredEuclideanDistance(struct pcl::segmentation::grabcut::Color const &,struct pcl::segmentation::grabcut::Color const &)" (??$squaredEuclideanDistance@UColor@grabcut@segmentation@pcl@@U1234@@pcl@@YAMAEBUColor@grabcut@segmentation@0@0@Z) already defined in grabcut_2d.cpp.obj bin\pcl_grabcut_2d.exe : fatal error LNK1169: one or more multiply defined symbols found --- .../include/pcl/segmentation/impl/grabcut_segmentation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/segmentation/include/pcl/segmentation/impl/grabcut_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/grabcut_segmentation.hpp index 2ef5fc27b16..5143080b6de 100644 --- a/segmentation/include/pcl/segmentation/impl/grabcut_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/grabcut_segmentation.hpp @@ -48,8 +48,8 @@ namespace pcl { template <> -float squaredEuclideanDistance (const pcl::segmentation::grabcut::Color &c1, - const pcl::segmentation::grabcut::Color &c2) +inline float squaredEuclideanDistance (const pcl::segmentation::grabcut::Color &c1, + const pcl::segmentation::grabcut::Color &c2) { return ((c1.r-c2.r)*(c1.r-c2.r)+(c1.g-c2.g)*(c1.g-c2.g)+(c1.b-c2.b)*(c1.b-c2.b)); }