Skip to content

Commit

Permalink
Make convert_hierarchy inline to prevent duplicate symbols
Browse files Browse the repository at this point in the history
Without inline, this function will have strong symbol type and will result in duplicate symbols linking error if this header gets included in more than one .cpp file.
See here https://en.cppreference.com/w/cpp/language/inline
>> There may be more than one definition of an inline function or variable (since C++17) in the program as long as each definition appears in a different translation unit and (for non-static inline functions and variables (since C++17)) all definitions are identical. For example, an inline function or an inline variable (since C++17) may be defined in a header file that is included in multiple source files.
  • Loading branch information
fplk0 authored Jul 20, 2022
1 parent ba0214b commit 1c0dc94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cvd/opencv.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace OpenCV

namespace Internal
{
void convert_hierarchy(const std::vector<cv::Vec4i>& cv_hierarchy, std::vector<ContourHierarchy>& hierarchy)
inline void convert_hierarchy(const std::vector<cv::Vec4i>& cv_hierarchy, std::vector<ContourHierarchy>& hierarchy)
{
hierarchy.reserve(cv_hierarchy.size());
std::transform(
Expand Down

0 comments on commit 1c0dc94

Please sign in to comment.