So I have a nested namespace in a header file. Inside the namespace I have some standalone data. However on compile, I get a "already define in <..>.obj". I tried messing around with inline but apparently inline only works with functions. Here is my code:
#ifndef HEADER_H #define HEADER_H namespace sod { namespace e { const int _2D = 0; const int _3D = 1; const int _CUSTOM = 2; const char *text1 = "I AM A C STRING"; // <-- char const * const sod::e::text1 (?text1@e@sod@@3PBDB) already defined in main.obj const char *text2 = "I AM ALSO A C STRING"; // <-- char const * const sod::e::text2 (?text2@e@sod@@3PBDB) already defined in main.obj }; }; #endif The editor I am using is Visual Studio 2017.
Any help is appreciated.
#indef? Or do you mean something else?#ifndefSorry, typo. Fixed now.