Ask Your Question
0

What caused this happen?CV_XADD parse issue in Xcode 4.2

asked 2012-11-21 21:49:20 -0600

imwmh gravatar image

Hi,

I am new in using Opencv with Xcode on MAC. I used to build the lib and compiled in XCode 3.2.6, it was ok. Then I upgraded my Xcode 4.2, but this time Xcode raised compiling error, says that /Developer/SDKs/MacOSX10.6.sdk/usr/local/include/opencv2/core/operations.hpp:63:69: note: instantiated from: #define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int))(addr), (delta), 5) ~~~^ /Developer/SDKs/MacOSX10.6.sdk/usr/local/include/opencv2/core/operations.hpp:2326:17: error: expected expression [1] CV_XADD(d.hdr.refcount, 1); ^ /Developer/SDKs/MacOSX10.6.sdk/usr/local/include/opencv2/core/operations.hpp:63:71: note: instantiated from: #define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int))(addr), (delta), 5) ^ /Developer/SDKs/MacOSX10.6.sdk/usr/local/include/opencv2/core/operations.hpp:2374:40:{2374:40-2374:64}: error: expected '(' for function-style cast or type construction [1] void addref() { if( hdr.refcount ) CV_XADD(hdr.refcount, 1); } Why did this happen and how could I o to modify it?

thanks

Minghao

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2013-02-21 04:51:46 -0600

Devylin gravatar image

Into file operations.hpp you have to comment:

#ifdef __cplusplus
/*
/////// exchange-add operation for atomic operations on reference counters ///////
#if defined __INTEL_COMPILER && !(defined WIN32 || defined _WIN32)   // atomic 
[...]
#else
  static inline int CV_XADD(int* addr, int delta)
  { int tmp = *addr; *addr += delta; return tmp; }
#endif
*/

and add these lines

static inline int CV_XADD(int* addr, int delta)
{ int tmp = *addr; *addr += delta; return tmp; }

after this part:

#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4127) //conditional expression is constant
#endif
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-11-21 21:49:20 -0600

Seen: 2,282 times

Last updated: Feb 21 '13