2012-12-05 75 views
1

在閱讀了關於FastFormat的一些信息之後,我決定下載並安裝在運行OS X 10.8的Macbook Pro上。我成功地獲得了FastFormat的構建,並運行了性能測試。然後,我寫了一個小測試,以檢查它是否工作:OS X上的FastFormat

#include <cstdlib> 
#include <fastformat/fastformat.hpp> 
#include <fastformat/sinks/ostream.hpp> 

int main() 
{ 
    return EXIT_SUCCESS; 
} 

在與G ++編譯它 - 4.7(並確保所有包含路徑是正確的),我得到了編譯時錯誤,如那些在PlatformSTL下面。

error: #error Operating system not discriminated. Only UNIX and Windows are currently recognised by PlatformSTL 
error: #error Operating system not discriminated 

我試圖通過手動定義unixPLATFORMSTL_OS_IS_UNIX抑制這些錯誤,但後來我收到這些鏈接器錯誤:

Undefined symbols for architecture x86_64: 
    "_fastformat_exitProcess", referenced from: 
     fastformat::fastformat_initialiser::fastformat_initialiser() in ccMqErni.o 
    "_fastformat_getInitCodeString", referenced from: 
     fastformat::fastformat_initialiser::record_init_failure_(int) in ccMqErni.o 
    "_fastformat_init", referenced from: 
     fastformat::fastformat_initialiser::fastformat_initialiser() in ccMqErni.o 
    "_fastformat_uninit", referenced from: 
     fastformat::fastformat_initialiser::~fastformat_initialiser() in ccMqErni.o 
ld: symbol(s) not found for architecture x86_64 
collect2: error: ld returned 1 exit status 

是FastFormat支持OS X,如果是這樣,我在做什麼錯誤?

回答

1

Mac OS X中不提供UNIX(或unix__unix____unix)宏PlatformSTL嘗試檢測哪個。我能夠編譯添加行defined(__MACH__)聲明platformstl.h像這樣(行154)後,你的例子:

#if defined(unix) || \ 
    defined(UNIX) || \ 
    defined(__unix__) || \ 
    defined(__unix) || \ 
    defined(__MACH__) 
# define PLATFORMSTL_OS_IS_UNIX 

要剿未定義的符號錯誤,您可以定義宏FASTFORMAT_NO_AUTO_INIT

g++ -I<path to fastformat and stlsoft headers> -DFASTFORMAT_NO_AUTO_INIT main.cpp

+0

謝謝!我猜STLSoft現在與OS X兼容。 –