It would be like this
Code:
// MyClass.h
#ifndef MYCLASS_H
#define MYCLASS_H
#include <string>
#include "Test.h"
class MyClass
{
public:
static std::string strPath;
};
#endif
Code:
// MyClass.cpp
#include "MyClass.h"
std::string MyClass::strPath = strTest;
Code:
// other.cpp
extern const std::string strTest = "Test";
Code:
//Test.h
extern const std::string strTest;
Code:
// main.cpp
#include <iostream>
#include "MyClass.h"
int main()
{
MyClass object;
std::cout << object.strPath << '\n';
std::cin.get();
return 0;
}
Edit: As you can tell from the example above Mario, I am including Test.h in MyClass.h, so strTest is known inside of MyClass.cpp where it is being assigned to strPath.