In the aData.h file I have
struct AnalysisData
{
Myuint64 maxRegsNeeded;
}
static const Myuint64 My_NA_Value_64 = (Myuint64) - 1;
Myuint64 is defined in the following way :
typedef unsigned long long Myuint64
If in the aData.cpp
file I make :
AnalysisData d;
d.maxRegsNeeded = My_NA_Value_64;
It works ok.
but if in the aData.cpp
I implement the function
setData(void* pD,size_t s)
{
memcpy(pD,&My_NA_Value_64 ,s);
}
if I implement that as :
setData(void* pD,size_t s)
{
Myuint 64 err = My_NA_Value_64;
memcpy(pD,&err ,s);
}
it is OK
The following code fails during the compilation,with undefined reference to My_NA_Value_64
:
AnalysisData d;
setData(&d.maxRegsNeeded,sizeof(d.maxRegsNeeded));
What is the reason for that?And how can it be solved?