c++ (systemC) 简单编译问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 02:29:38
一个函数是这个样子的:
inline void sc_trace( sc_trace_file * tf, const pkt & a, const sc_string & name )
{
sc_trace( tf, a.data, name + ".data" );
sc_trace( tf, a.id, name + ".id" );
sc_trace( tf, a.dest0, name + ".dest0" );
sc_trace( tf, a.dest1, name + ".dest1" );
sc_trace( tf, a.dest2, name + ".dest2" );
sc_trace( tf, a.dest3, name + ".dest3" );
}

主函数这么调用: sc_trace(tf, pkt_out2, "PKT_OUT2");

pkt_out2是pkt类型的 结构体,提示错误时 error C2065: 'name' : undeclared identifier

但这里不是已经定义了 const sc_string & name了吗?这里的sc_string跟c++的string 是一样的

谢谢了~
不会死循环的~因为 啊是个结果题~这里分别输出结构体的几个变量。

name 是个常量,能不能对常量做+ 运算的啊?
不知道是不是这个问题..

还有..弱弱的问下,你这函数这么写,不会死循环吗?我怎么觉得会无限递归下去啊

函数有没有声明?
还有不要对 const 变量做修改

请问您是怎么解决的? 我也遇到类似问题 从来没用过这个

把代码全部贴上吧
这样不好分析