There is a header file say header1.h from a C library. In header1.h,
51 enum ConnectionState {
52 InProgress = 0,
53 BannerWaitEol = 1,
54 BannerDone = 2,
55 Finished = 3,
56 };
57 typedef uint8_t ConnectionState;
I use it in my C++ code as
extern "C"
{
#include "header1.h"
}
But I got a compile error
header1.h:57:17: error: conflicting declaration 'typedef uint8_t ConnectionState'
typedef uint8_t ConnectionState;
^~~~~~~~~~~~~~~~~~
header1.h:51:6: note: previous declaration as 'enum ConnectionState'
enum ConnectionState {
^~~~~~~~~~~~~~~~~~
I read the post: Conflicting declaration in c++. And now I understand it is the typedef difference between C and C++. But I can not change header1.h because it is from a third-party library. How do I use this header1.h in my C++ application? Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire