lundi 5 août 2019

Split declaration and defintion of c++ enum class

I'd like to use a enum class in the following way

// Foo.h
enum class Foo : uint8_t;

with

// Foo.cpp
enum class Foo : uint8_t {
  FOO = 0,
  BAR = 1
};

and

// Main.cpp
#include "Foo.h"
int main () {
  (void)Foo::FOO;
  return 0;
}

But I get following error

incomplete type 'Foo' named in nested name specifier

Does somebody know how to solve this "problem"?

Thanks

Aucun commentaire:

Enregistrer un commentaire