문제

I'm having this very weird problem, only in my project. I'm using XCode 4.3.6 and trying to add Accelerating Framework to my project. So in my file I just do a simple import statement:

#import <Accelerate/Accelerate.h>

And then I build my project and get 4 errors in the file clapack.h file of vecLib.framework pointing to these lines:

int claswp_(__CLPK_integer *n, __CLPK_complex *a, __CLPK_integer *lda, __CLPK_integer *
    k1, __CLPK_integer *k2, __CLPK_integer *ipiv, __CLPK_integer *incx) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_4_0);

int dlaswp_(__CLPK_integer *n, __CLPK_doublereal *a, __CLPK_integer *lda, __CLPK_integer 
    *k1, __CLPK_integer *k2, __CLPK_integer *ipiv, __CLPK_integer *incx) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_4_0);

int slaswp_(__CLPK_integer *n, __CLPK_real *a, __CLPK_integer *lda, __CLPK_integer *k1, 
    __CLPK_integer *k2, __CLPK_integer *ipiv, __CLPK_integer *incx) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_4_0);

int zlaswp_(__CLPK_integer *n, __CLPK_doublecomplex *a, __CLPK_integer *lda, 
    __CLPK_integer *k1, __CLPK_integer *k2, __CLPK_integer *ipiv, __CLPK_integer *incx) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_4_0);

All these errors showing that there's a missing expected closing bracket ')' at k1. It's weird that I don't get these errors in any other projects at all. What could be the reason for this error? I'd be really appreciate it if someone can suggest a solution for this.

도움이 되었습니까?

해결책

Your code (or one of the headers that you include before <Accelerate/Accelerate.h>) defines a macro with the name k1. Something like:

#define k1 *some expression*

It’s a bug for a system library to use “common” parameter names like this for exactly this reason, but it’s also bad style for you to use them as macro names for the same reason.

There are a few ways that you can resolve the issue:

  1. Change the name of your macro.
  2. Move the definition of your macro so that it comes after the inclusion of the Accelerate header.
  3. If you’re not using the LAPACK functions, but instead some other part of Accelerate, you can prevent the compiler from seeing the clapack.h prototypes via include-guard abuse:

     #define __CLAPACK_H // hide clapack.h prototypes
     #import <Accelerate/Accelerate.h>
    

다른 팁

Please refer this link : https://github.com/aosm/xnu/blob/master/EXTERNAL_HEADERS/Availability.h

 The desktop Mac OS X and iOS each have different version numbers.
 The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop
 and iOS version numbers. For instance:
 __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)
 means the function/method was first available on Mac OS X 10.2 on the desktop
and first available in iOS 2.0 on the iPhone.
If a function is available on one platform, but not the other a _NA (not
applicable) parameter is used. For instance:
__OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)
means that the function/method was first available on Mac OS X 10.3, and it
currently not implemented on the iPhone.

At some point, a function/method may be deprecated. That means Apple
recommends applications stop using the function, either because there is a
better replacement or the functionality is being phased out. Deprecated
functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()
macro which specifies the OS version where the function became available
as well as the OS version in which it became deprecated. For instance:
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)
means that the function/method was introduced in Mac OS X 10.0, then

deprecated beginning in Mac OS X 10.5. On iOS the function has never been available.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top