[英]I am getting an "error: redefinition of" symbol, even though I have used the same syntax earlier in the file,
I am creating a function stub (for a function foo_print_stats()) for a unit test,and have written the following code:我正在为单元测试创建一个函数存根(用于函数 foo_print_stats()),并编写了以下代码:
static void my_foo_stats(foo_fs_t * const fsys) {
return;
}
#undef foo_print_stats
#define foo_print_stats my_foo_stats
I keep getting the error "redefininiton of my_foo_stats".我不断收到错误“my_foo_stats 的重新定义”。 I have tried changing the name to something else, to no avail.我尝试将名称更改为其他名称,但无济于事。 The parameters for my_foo_stats are the exact same as those passed to foo_print_stats. my_foo_stats 的参数与传递给 foo_print_stats 的参数完全相同。 I am confused because I have used the exact same syntax many times int the same file and it has all worked.我很困惑,因为我在同一个文件中多次使用完全相同的语法,并且一切正常。
Realized that the file where the function was initially being defined was getting included below where I was trying to redefine it.意识到最初定义函数的文件被包含在我试图重新定义它的下面。 thanks to @Tom Karzes for advice感谢@Tom Karzes 的建议
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.