我试图使用C SD驱动程序/文件系统libary(凯尔MDK),在C++ 11的项目。 Keil MDK 5.23中的Pack Manager增加了它。我与ARMCC编译5.06u4
我得到警告class "_ARM_MCI_STATUS"
有没有合适的拷贝构造函数”这是奇怪的,因为它在声明的头有extern "C" {
。
默认情况下,该组没有选项来设置它C或C++,但我已经手动添加的文件作为C文件仍然是一个问题
的结构被声明,内extern "C" {
为:。
typedef volatile struct _ARM_MCI_STATUS {
uint32_t command_active : 1; ///< Command active flag
uint32_t command_timeout : 1; ///< Command timeout flag (cleared on start of next command)
uint32_t command_error : 1; ///< Command error flag (cleared on start of next command)
uint32_t transfer_active : 1; ///< Transfer active flag
uint32_t transfer_timeout : 1; ///< Transfer timeout flag (cleared on start of next command)
uint32_t transfer_error : 1; ///< Transfer error flag (cleared on start of next command)
uint32_t sdio_interrupt : 1; ///< SD I/O Interrupt flag (cleared on start of monitoring)
uint32_t ccs : 1; ///< CCS flag (cleared on start of next command)
uint32_t reserved : 24;
} ARM_MCI_STATUS;
当该结构是为发生该问题[R在eturned:
static ARM_MCI_STATUS GetStatus (MCI_RESOURCES *mci) {
return mci->info->status;
}
凡status
被声明为ARM_MCI_STATUS status;
。我不明白为什么它应该是一个问题。
如果我编译没有--cpp,那么它编译没有问题。
有什么建议吗?
仅仅因为它被标记为'extern“C”并不意味着它绕过了C++规则。 –
结构和类型名称永远不需要'extern“C”',只有函数可以。它所做的基本上是防止函数的[name-mangling](https://en.wikipedia.org/wiki/Name_mangling)。 –
@RickAstley我正在收集,虽然我是/不知道一个特定的C++规则需要一个基本的C位字段的复制构造函数。你知道吗? – Flip