简体   繁体   English

GCC错误:之前应为&#39;)&#39; <function protoyprmeter> 参数

[英]GCC error: expected ‘)’ before <function protoyprmeter> parameter

In a header file 在头文件中

extern void Trace_Communication(communicationBlock_t mdbMessage);

gives error: expected ')' before 'mdbMessage' 给出error: expected ')' before 'mdbMessage'

I am sure that communicationBlock_t is in scope (and reliaze that it would be more efficient to pass a pointer) 我确定communicationBlock_t在范围内(并确保传递指针会更有效)

If I copy the declaration of communicationBlock_t just before the extern offending line, the error is 如果我在extern违规行之前复制了communicationBlock_t的声明,则错误是

error: conflicting types for ‘communicationBlock_t’  
note: previous declaration of ‘communicationBlock_t’ was here

Which seems to imply that the offending line has access to the declaration of communicationBlock_t 这似乎暗示有问题的行可以访问communicationBlock_t的声明

I guess that I am overlooking something trivial and obvious, but I have been coding all night and can no longer think straight ... 我想我忽略了一些琐碎而明显的事情,但是我整夜都在编码,再也无法直觉...

What am I doing wrong? 我究竟做错了什么? Thanks 1 ,000,000 谢谢1,000,000


Update: my guess is that it's an include file tangle ... 更新:我的猜测是这是一个包含文件纠结...

typedef struct
{
  communicationMessage_t message;
  uint8_t                length;
#ifdef TESTING
   char                   commandName[32];    // for testing porpoises 
   DoRunTimeChecks        runTimeCheckCallback;
#endif      
} communicationBlock_t;

Looks to me like you're using a variable as a type name. 在我看来,您正在使用变量作为类型名称。 What does the declaration of communicationBlock_t look like? communicationBlock_t的声明是什么样的?

Sorry, folks. 抱歉,伙计们。 It was, as I suspected a deady embrace in #include files 因为我怀疑#include文件中有致命的拥抱

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gcc错误:“ else”之前的预期表达式 - gcc error: expected expression before 'else' gcc c错误:在数字常量之前预期&#39;)&#39; - gcc c error: expected ')' before numeric constant dbus-1 gcc错误:在“结构”之前应为“;”,“或”) - dbus-1 gcc error: expected ';', ',' or ')' before 'struct' gcc编译器和makefile:错误:预期的标识符或&#39;&&#39;标记前的&#39;(&#39; - gcc compiler and makefile: error: expected identifier or ‘(’ before ‘&’ token 如何修复“错误:预期; , or ) before” 字符串参数 - How to fix “error: expected ; , or ) before” string parameter gcc错误:“出队”之前应为“ =”,“,”,“ ASM”或“ __attribute__” - gcc error: expected '=', ',', 'ASM', or '__attribute__' before 'dequeue' 在gcc中编译时出错,预期标识符&#39;(&#39;在&#39;double&#39;之前 - Error when compiling in gcc, expected identifier '(' before 'double' 如何修复gcc错误:在void之前预期 - How to fix gcc error: expected while before void 函数原型错误,在 &#39;int&#39; 之前应为 &#39;=&#39; ... - Function Prototype Error, Expected '=' ... before 'int' 错误:[功能]之前应为&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - error: expected '=', ',', ';', 'asm' or '__attribute__'before [function]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM