I have issue that is reproduced on g++. VC++ doesn't meet any problems. So I have 2 cpp files:
1.cpp:
#include <string>
#include <iostream>
extern const std::string QWERTY;
int main()
{
std::cout << QWERTY.c_str() << std::endl;
}
2.cpp:
#include <string>
const std::string QWERTY("qwerty");
No magic, I just want place string constants into separated file. At link time ld produces an error: "undefined reference to `_QWERTY'" The first think to wrap both declarations into "extern "C"" - didn't help. Error and non c++ _QWERTY is still there.
Thanks in advance for any suggestions