Skip to content

Linking the two .cpp files results in duplicate definition errors #8804

@YunLingyan

Description

@YunLingyan

Issue Details

I have placed the two files kinetic_partition.cpp and ksr_basic.cpp in the same folder of my project (with the CGAL environment properly configured). However, during linking, the linker reports errors about duplicate definitions of the same symbols. The full error messages are as follows:

1>ksr_basic.obj : error LNK2005: "class std::tuple<unsigned char,unsigned char,unsigned char> const __cdecl CGAL::KSP_3::internal::get_idx_color(unsigned __int64)" (?get_idx_color@internal@KSP_3@CGAL@@ya?BV?$tuple@EEE@std@@_K@Z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_polygon(class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_polygon@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_polygona(class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_polygona@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_polygons(class std::vector<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > >,class std::allocator<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_polygons@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@v?$allocator@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@@2@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_polygons(class std::vector<class std::vector<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > >,class std::allocator<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > > >,class std::allocator<class std::vector<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > >,class std::allocator<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > > > > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_polygons@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$vector@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@v?$allocator@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@@2@@std@@v?$allocator@V?$vector@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@v?$allocator@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@@2@@std@@@2@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_indexed_triangles(class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > const &,class std::vector<unsigned __int64,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_indexed_triangles@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@aebv?$vector@_KV?$allocator@_K@std@@@5@AEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_indexed_polygons(class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > const &,class std::vector<class std::vector<unsigned __int64,class std::allocator >,class std::allocator<class std::vector<unsigned __int64,class std::allocator > > > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_indexed_polygons@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@aebv?$vector@V?$vector@_KV?$allocator@_K@std@@@std@@v?$allocator@V?$vector@_KV?$allocator@_K@std@@@std@@@2@@5@AEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_polygons(class std::vector<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > >,class std::allocator<class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > > > const &,class std::vector<class CGAL::IO::Color,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_polygons@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@v?$allocator@V?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@@2@@std@@aebv?$vector@VColor@IO@CGAL@@v?$allocator@VColor@IO@CGAL@@@std@@@5@AEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj
1>ksr_basic.obj : error LNK2005: "void __cdecl CGAL::KSP_3::internal::dump_points(class std::vector<class CGAL::Point_3,class std::allocator<class CGAL::Point_3 > > const &,class std::vector<class CGAL::Vector_3,class std::allocator<class CGAL::Vector_3 > > const &,class std::vector<class CGAL::IO::Color,class std::allocator > const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?dump_points@internal@KSP_3@CGAL@@YAXAEBV?$vector@V?$Point_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Point_3@VEpick@CGAL@@@CGAL@@@std@@@std@@aebv?$vector@V?$Vector_3@VEpick@CGAL@@@CGAL@@v?$allocator@V?$Vector_3@VEpick@CGAL@@@CGAL@@@std@@@5@AEBV?$vector@VColor@IO@CGAL@@v?$allocator@VColor@IO@CGAL@@@std@@@5@AEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@5@@z) already defined in kinetic_partition.obj

I believe there are some issues with the header file implementation, and I hope these problems can be resolved here.

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits): Windows 64 bits
  • Compiler: VS 2022
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version:
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions