繁体   English   中英

“不完整类型不允许”错误是什么意思?

[英]What does the “incomplete type is not allowed” error mean?

我试图在C ++中声明一个回调例程,如下所示:

void register_rename (int (*function) (const char *current, const char *new));
    /*------------------------------------------------------------*/
    /* WHEN:  The callback is called once each time a file is received and
     *   accepted.   (Renames the temporary file to its permanent name)
     * WHAT:  Renames a file from the given current name to the specified new name.
     */

但是,我收到以下错误:

line 204: error #70: 
      incomplete type is not allowed
void register_rename (int (*function) (const char *current, const char *new));

我不知道如何纠正这个问题。 我在同一个头文件中声明了其他类似的回调例程,我没有收到此错误。

请帮忙! :)

您不能使用new,因为它是关键字。 尝试为第二个参数选择有效的标识符。

您不能使用保留字命名变量(或任何标识符);

保留字是关键字

asm do if return try
auto double inline short typedef
bool dynamic_cast int signed typeid
break else long sizeof typename
case enum mutable static union
catch explicit namespace static_assert unsigned
char export **new** static_cast using
class extern operator struct virtual
const false private switch void
const_cast float protected template volatile
continue for public this wchar_t
default friend register throw while
delete goto reinterpret_cast true

以及一些运营商的替代名称

and and_eq bitand bitor compl not
not_eq or or_eq xor xor_eq

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM