What does this mean?
1>c:\users\vitali\documents\visual studio 2010\projects\salam\tools.cpp(107): error C2084: function 'bool readXMLInteger(xmlNodePtr,const char *,int &)' already has a body
1>c:\users\vitali\documents\visual studio 2010\projects\salam\tools.h(52) : see previous definition of 'readXMLInteger'
tools.cpp(107):
bool readXMLInteger(xmlNodePtr node, const char* tag, int32_t& value)
{
char* nodeValue = (char*)xmlGetProp(node, (xmlChar*)tag);
if(nodeValue)
{
value = atoi(nodeValue);
xmlFreeXOXL(nodeValue);
return true;
}
return false;
}
tools.h(52)
bool readXMLInteger(xmlNodePtr node, const char* tag, int& value);
Did you use include guards in your original header file?
For example:
#ifndef _TOOLS_H_
#define _TOOLS_H_
... your header body is here ...
#endif
This blocks against re-defining in each cpp where it is included.
It means that at some point your actual code is being re-read into the compile stream, so it seems two attempts at defining (as opposed to declaring) the function.
Suspect something about the way you set up the preprocessor statements.
Perhaps you already found the solution, but for me rebuilding the solution fixed it.
I moved my implementation from the header file to the .cpp
file and the .pch
file already had this info. So, I had to rebuild to fix this error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With