Compiling with Visual Studio 2005, on Windows XP. I add the following headers to my "stdafx.h" file like so:
#include <atlbase.h>
#include <atlcom.h>
#include <atlcore.h>
#include <atlstr.h>
(technically the same error appears with just atlbase.h included) which produces the following errors:
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
error C2062: type 'double' unexpected
in the following code:
struct CheckValue : public unary_function<pair<MetID,double>,void>{
CheckValue(double _expected) : m_Expected(_expected){}
inline void operator()(const pair<MetID,double> &_val){
m_CheckList.push_back( near( _val.second ) ? 0 : 1 );
}
inline bool near(double _val){ //here is location of both errors
return ( m_Expected - m_Epsilon < _val ) || ( _val < m_Expected + m_Epsilon );
}
const static double m_Epsilon;
const double m_Expected;
list<int> m_CheckList;
};
const double CheckValue::m_Epsilon = 0.00001;
Without those lines added, no problems. Anyone want to venture a guess as to why? I'm scratching my head here and can't continue writing unit tests without those include files.