Skip to content

declaration conflicts with abs #71896

@Master-Chi

Description

@Master-Chi

Dear, community
I am running into a problem when compiling opencv2 using clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04. The error message showed a conflict in the declaration of the abs function in complex and cmath. However, I don't know how to solve this problem as it seems that both are in the std namespace.

In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/src/algorithm.cpp:43:
In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/src/precomp.hpp:48:
In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/include/opencv2/core/core.hpp:56:
/home/temp/toolchains/clang/bin/../include/c++/v1/complex:854:1: error: declaration conflicts with target of using declaration already in scope0m
abs(const complex<_Tp>& __c)
^
/home/temp/toolchains/clang/bin/../include/c++/v1/cmath:339:1: note: target of using declaration
using ::abs _LIBCPP_USING_IF_EXISTS;
^
/home/temp/toolchains/clang/bin/../include/c++/v1/cmath:339:9: note: using declaration
using ::abs _LIBCPP_USING_IF_EXISTS;
^
In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/src/algorithm.cpp:43:
In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/src/precomp.hpp:48:
In file included from /home/temp/algorithm-libs/mi_v1.0.0-qsee/src/opencv2/core/include/opencv2/core/core.hpp:56:
/home/temp/toolchains/clang/bin/../include/c++/v1/complex:911:16: error: reference to unresolved using declaration
return abs(__c.real());
^
/home/temp/toolchains/clang/bin/../include/c++/v1/cmath:339:1: note: using declaration annotated with 'using_if_exists' here
using ::abs _LIBCPP_USING_IF_EXISTS;
^

Look forward to your reply
BRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidResolved as invalid, i.e. not a buglibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions