I was looking for forward declaration information and did not see any way to make my situation work. So here it is:
1) There is a C-header file, an export interface, so to speak, for large multi-component software containing a typedef enumeration
"export.h":
// This is in "C"! typedef enum _VM_TYPE {...., ...., ...,} VM_TYPE;
2) Part of the code in C ++ uses this export.
"cpp_code.cpp":
// This is in C++
"cpp_header.hpp":
So obviously, the problem is in cpp_head.hpp, because it does not know about this listing.
I tried adding to cpp_header.hpp
typedef enum _VM_TYPE VM_TYPE;
and it really will work. So why does this work? Because it has C-style syntax ?! In any case, I was told not to do this ("this is C ++, not C here") by the top "control".
Is there any other way to make this work at all based on how things are currently connected? They do not want to modify / add include files; "enum class" is only C ++, right? Adding only "enum VM_TYPE" to cpp_header.hpp will receive an override error.
Any idea? Thanks.
c ++ c enums declaration forward
Andrew
source share