We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 57588

2013.2 Vivado HLS - demo.cpp:30: error: call of overloaded 'cosf(float&)' is ambiguous


When "hls_math.h" is included and "using namespace hls" is declared, the following error is received when compiling the "cosf" file:

@E [HLS-70] Compilation errors found:
demo.cpp: In function 'void demo(float*)':
demo.cpp:30: error: call of overloaded 'cosf(float&)' is ambiguous
c:/xilinx/vivado_hls/2013.2/win_x86/tools/llvm_gcc/bin/../lib/gcc/i686-pc-mingw32/4.2.1/../../../../include/math.h:450: note: candidates are: float cosf(float)
C:/Xilinx/Vivado_HLS/2013.2/include/hls_math.h:434: note:                 float hls::cosf(float)

Failed checking during preprocessing.
    while executing
    (file "C:/ybd/case/HLS_cosf/demo/hls/solution2/csynth.tcl" line 14)


This issue occurs because if hls_math.h is included, math.h is indirectly included.
As a result, when you call "using namespace hls", the error is received.
This is a known issue.

It can be difficult to avoid including math.h, as it is indirectly included from a number of basic header files.
To work around this, use the prefix "hls::".
AR# 57588
Date 03/27/2015
Status Active
Type General Article
  • Vivado Design Suite - 2013.2