2

I use a data structure bimap

typedef boost::bimap< std::string, int > hash_bimap;
typedef hash_bimap::value_type position;
hash_bimap perm;

and it works fine in main file. However, i am interested to use it in header file to make it accessible in any other .cpp file.

when I try to make it extern in my.h like

extern typedef boost::bimap< std::string, int > hash_bimap;
extern typedef hash_bimap::value_type position;
extern hash_bimap perm;

conflicting specifiers in declaration of ‘hash_bimap’ extern typedef boost::bimap< std::string, int > hash_bimap;

AwaitedOne
  • 992
  • 3
  • 19
  • 42

1 Answers1

3

(elaborating on kfsone's comment) typedefs don't need to be extern, just the actual variable:

typedef boost::bimap< std::string, int > hash_bimap;
typedef hash_bimap::value_type position;
extern hash_bimap perm;
Mark B
  • 95,107
  • 10
  • 109
  • 188