I have a program which works fine under VC++, but is giving me an error under GCC.
within log.h:
namespace logType {
enum Enum {
None = 0,
Info,
Warning,
Error,
};
std::string Name[];
}
within log.cpp:
std::string logType::Name[] = {
"None",
"Info",
"WARNING",
"ERROR"
};
This works fine when I compile log.cpp. However, if any other file includes log.h, that file errors out:
error: storage size of ‘logType::Name’ isn't known
I’ve tried specifying the array size for Name[] in one or both of the files, but that just changes the error to that of redeclaration.
How do I get this to cooperate under GCC?
Add
externtolog.h‘s declaration of your Name. Your symbol appears in two places.