Ask Your Question
0

Building OpenCV problem : 'ptrdiff_t' : is not a member of 'std'

asked 2013-04-08 17:37:40 -0600

HIy gravatar image

updated 2018-12-15 11:15:16 -0600

berak gravatar image

Hi all,

I am trying to build an openCV application in Visual Studio 2010. Have OpenCV 2.4.4. I get the following error during compilation:

\\OpenCV\2.4\include\opencv2/core/core.hpp(81): error C2039: 'ptrdiff_t' : is not a member of 'std'
\\OpenCV\2.4\include\opencv2/core/core.hpp(81): error C2868: 'ptrdiff_t' : illegal syntax for using-declaration; expected qualified-name;

Based on a google search, I tried adding to the core.hpp file.

\#include "cstddef.h"

and separately

\#include "stddef.h"

Both approaches did not work. Has any one run into similar issues? What is the fix?

Thanks.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2013-04-09 02:15:00 -0600

berak gravatar image

updated 2013-04-09 02:21:24 -0600

hmm, <cstddef> is already included in line 61.

any chance, that a var named "SKIP_INCLUDES" is set in your build env ?

also it should be #include <cstddef> instead, since #include "stddef.h" won't use namespace std

edit flag offensive delete link more
-1

answered 2018-12-15 11:09:39 -0600

Robby gravatar image

I had the same problem on one Windows installation but not on another. So I compared the Visual Studio include files and found one difference which solved the problem:

In the file ...VisualStudio\VC\Include\yvals.h

change

define _GLOBAL_USING 0

into

define _GLOBAL_USING 1

edit flag offensive delete link more

Comments

@Robby, the question is from 2013 (and entirely outdated)

apart from that, changing your compiler's internal headers is an awful hack, don't do that !

berak gravatar imageberak ( 2018-12-15 11:13:17 -0600 )edit
1

@berak: It is stupid to down vote an answer while you don't provide a better solution. For me setting _GLOBAL_USING 1 solves the problem and does not produce any side effect. The project compiles smoothlessly and the application works perfectly. So what do you want more?

Robby gravatar imageRobby ( 2019-11-30 11:45:31 -0600 )edit

@Robby, the downvote was for highlighting a problem with an outdated opencv version, which cannot ever be fixed. also, meddling with your compilers headers globally while trying to solve a local (opencv) problem is NEVER a good idea

apologies, if you found it offensive

berak gravatar imageberak ( 2019-11-30 11:52:15 -0600 )edit

Question Tools

Stats

Asked: 2013-04-08 17:37:40 -0600

Seen: 4,008 times

Last updated: Dec 15 '18