Guten TagCopy-Konstruktor für C flüchtiges bitfield struct
Ich versuche, ein C SD-Treiber/Dateisystem libary (Keil MDK) zu verwenden, in einem Projekt C++ 11. Es wurde vom Pack-Manager in Keil MDK 5.23 hinzugefügt. Ich bin Kompilieren mit ARMCC 5.06u4
ich die Warnung class "_ARM_MCI_STATUS"
keinen passenden Copykonstruktor“hat, die ungerade ist, da der Header es in extern "C" {
hat erklärt wird.
hat standardmäßig das Paket keine Option zu setzen es zu C oder C++, aber ich habe hinzugefügt manuell die Datei als C-Datei immer noch ein Problem
die Struktur deklariert wird, innerhalb extern "C" {
als:..
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;
das Problem tritt auf, wenn die Struktur zu sein, ist r eturned an:
static ARM_MCI_STATUS GetStatus (MCI_RESOURCES *mci) {
return mci->info->status;
}
Wo status
als ARM_MCI_STATUS status;
erklärt. Ich sehe nicht, warum es ein Problem sein sollte.
Wenn ich ohne die - CPP kompilieren, kompiliert es ohne Problem.
Irgendwelche Vorschläge?
Nur weil es als "extern" gekennzeichnet ist C "" bedeutet nicht, dass es die C++ - Regeln umgeht. –
Strukturen und Typnamen brauchen nie 'extern 'C'', nur Funktionen tun. Was es tut, verhindert im Grunde [name-mangling] (https://en.wikipedia.org/wiki/Name_mangling) von Funktionen. –
@RickAstley Ich sammle das, obwohl mir eine bestimmte C++ - Regel, die einen Kopierkonstruktor für ein einfaches C-Bit-Feld erfordert, nicht bekannt ist. Weißt du was? – Flip