2012-12-13 31 views
0

我想在一個小型的C++程序上使用Accelerate framework。我甚至沒有使用XCode,只有一個簡單的Makefile。如何使用i686-apple-darwin11-llvm-g ++ - 4.2包含加速框架?

當我下面的行添加到我的代碼編譯器會抱怨:

#include <Accelerate/Accelerate.h> 

的錯誤是:

In file included from /System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:41, 
       from /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20, 
       from Diana.cpp:20: 
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected identifier before numeric constant 
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected `}' before numeric constant 
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected unqualified-id before numeric constant 
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9028: error: expected declaration before ‘}’ token 

我使用的編譯器的i686-蘋果darwin11 -llvm -g ++ - 4.2,這是一個gcc 4.2.1,和我用來編譯(不鏈接)的行是:

i686-apple-darwin11-llvm-g++-4.2 -D__MACOSX_CORE__ -c -o Diana.o Diana.cpp 

編譯時應該添加一些額外的標誌嗎?我嘗試添加「-framework Accelerate」,但它不會改變任何內容,因爲這應該只包含在鏈接過程中(對嗎?)。

我GOOGLE了一些這些錯誤消息,我什麼也沒找到。

我真的很感激任何幫助。謝謝!

PS:我的OS X版本是Lion 10.7.5,XCode是4.4.1。

回答

1

我想通了:我檢查了vDSP.h的9008行,並且問題是我在包含Accelerate.h之前聲明瞭FFT_FORWARD常量。

固定!