简体   繁体   English

声明没有声明任何东西 C++ 错误

[英]Declaration does not declare anything C++ error

I'm having a problem with the NIOS 2 SD Card Libary.我在使用 NIOS 2 SD 卡库时遇到问题。

The problem is referenced to this part of the libary:问题引用到库的这一部分:

#ifndef bool
    typedef enum e_bool { false = 0, true = 1 } bool;
#endif

The NIOS Eclipse compiler resulted me this error: NIOS Eclipse 编译器给我带来了这个错误:

declaration does not declare anything

What might be causing this issue?什么可能导致此问题?

in C++ bool is a keyword not a macro so the code above inside the ifdef is skipped and not compiled.在 C++ 中, bool是关键字而不是宏,因此ifdef中的上述代码将被跳过且未编译。

In C code sometimes bool is defined as a macro在 C 代码中有时bool被定义为宏

#define bool int
#define true 1
#define false 0

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

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