hi All,
Its been ages since I programmed in C++. Forgot more than I remember. More as an exercise, I downloaded rocksdb sources and all the sources for dependent libraries. I managed to get all the dependent lib's built, and all but one of the rocskdb projects built.
One uses gflags is throwing a whole bunch of "error C2370: *** redefinition; different storage class..." errors. it is throwing a C2370 for every gflags definition. The declarations for all the flags are in the header file, look correct. I just remember that sometimes I got these if a function/variable was used without being declared, or before it was declared.
Any suggestions, maybe someone knows gflags or rocksdb, or more "how to fix" C2370? People report they are able to build, so I must be doing something wrong. I don't see any errors prior to the first C2370, but maybe a header file include is broken (one of those #ifdef or #ifndef)
THanks
MP
Thanks kbw. Just intalled 2019, still get the same error. Got some time to tinker with the project tonight.
Have a C++ project (visual studio 2019 now). It has a cpp file that has a bunch of gflags defines, like this:
DEFINE_uint64(seed, 2341234, "Seed for PRNG");
The header file has matching DECLARE macros.
DECLARE_uint64(seed);
When I run the build every single one of the DEFINE's get a storage class error:
Severity Code Description Project File Line Suppression State
Error C2370 'fLU64::FLAGS_seed': redefinition; different storage class db_stress C:\projects\rocksdb\db_stress_tool\db_stress_gflags.cc 22
If I rename the variable in the cpp file, in the DEFINE, to seed1, rebuild, then the error goes away for that variable, but in another cpp file, I get an undeclared variable error.
I think there must be a way to cause the compiler to expand the macros so I can see what the problem is. I think all the header files are in the right place, and the cmake build didn't modify any. Something wrong with the way the gflags macros are getting expanded on my system.
Im not quite "at one" with the compiler flags, I think. So if I expand the macros by hand, in the header file and in the cpp file, compilation fails the same way. So far so good (bad?)
Now the header expansion looks like this:
//DECLARE_uint64(seed);
namespace fLU64
{ extern ::google::uint64 FLAGS_seed;
} using fLU64::FLAGS_seed;
Just the old ones. Thanks for the tip, I'll get everything new and try again. Ive been doing all kind of tinkering to see what is wrong under the hood. Nice to move past this!! Thanks for the tip in vcxproj files.