I have a class in project Utils as follows:
Maths.h
class __declspec(dllexport) Maths
{
public:
static const double c_epsilon;
...
}
Maths.cpp
const double Maths::c_epsilon = DBL_EPSILON;
I then have (many) other projects that use this class (and use the c_epsilon constant).
Almost all other projects build and link without issue... but a couple fail with the error:
LNK2001 unresolved external symbol "__declspec(dllimport) public: static double const Maths::c_epsilon" (__imp_?c_epsilon@Maths@@2NB)
The two failing projects are both Google Test projects and other than producing an executable (instead of a DLL) appear to be set up the same as all other projects.
The failing projects definitely do specify the Utils.lib file.
I can only imagine this is a project setting issue (as other projects are fine), but I can't find any settings that differ that resolve the issue.