giovedì 28 aprile 2011

OpenCV 2.2 'std::ptrdiff_t' error

Go to /usr/include/opencv2/ or wherever your opencv library is installed.

cd usr/lib/include/opencv2/
Open and edit the file core/core.hpp
gedit core/core.hpp
At row 54 starts this block:
#ifndef SKIP_INCLUDES
#include <limits.h>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <new>
#include <string>
#include <vector>
#endif // SKIP_INCLUDES
Add #include <cstddef> to the list.
#ifndef SKIP_INCLUDES
#include <limits.h>
#include <algorithm>
#include <cmath>
#include <complex>
#include <map>
#include <new>
#include <string>
#include <vector>
#include <cstddef>
#endif // SKIP_INCLUDES
Done :)