2015.4 Vivado HLS - ***。h:193:7:错误:在数字常量之前预期不合格的id

描述

当我将“ap_int.h”包含为头文件时,我在C仿真中遇到以下错误:


在调试模式下编译../../../../cholesky_inverse_tb.cpp
在/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../中包含的文件中。 /../include/c++/4.6.3/ios:45:0,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../ .. /include/c++/4.6.3/ostream:40,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../ .. /include/c++/4.6.3/iostream:40,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/include/etc/ap_int_sim.h:76,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/include/ap_int.h:74,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/include/ap_fixed.h:67,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/include/hls/linear_algebra/hls_matrix_multiply.h:61,
来自/proj/gsd/vivado/Vivado_HLS/2015.4/include/hls_linear_algebra.h:43,
来自../../../../cholesky_inverse.h:35,
来自../../../../cholesky_inverse_tb.cpp:32:
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:193:7:错误:数字常量前的预期unqualified-id
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:在成员函数'std :: basic_ios <_CharT,_Traits> :: operator void *()const'中:
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:114:22:错误:数字常量前的预期unqualified-id
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:114:22:error:expected';'在数字常量之前
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:114:27:错误:'0'不能用作函数
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:在成员函数'bool std :: basic_ios <_CharT,_Traits> :: operator!()const'中:
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:118:22:错误:数字常量之前的预期unqualified-id
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:118:22:错误:预期';'在数字常量之前
/proj/gsd/vivado/Vivado_HLS/2015.4/lnx64/tools/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../ include / c ++ / 4.6.3 / bits / basic_ios.h:118:27:错误:'0'不能用作函数

我该如何解决这个问题?

在上面的示例中,声明了一个与头文件冲突的宏。

例如,您有以下定义:

#define失败0

但是,头文件“basic_ios.h”包含以下定义:

布尔
fail()const
{return(this-> rdstate()&(badbit | failbit))!= 0; }

预处理器不知道如何解释代码,它将“fail”替换为“0”。结果,出现此问题。

要解决此类问题,请注意您的宏定义不会与预定义的关键字冲突。

编辑 重设标签(回车键确认) 标为违禁 关闭 合并 删除

提问于 2018-07-30 19:47:51 +0800

这个帖子被标记为一个社区wiki

这个帖子是一个wiki(维基). 任何一个积分 >500的人都可以完善它