1

FastFormat について少し読んだ後、OS X 10.8 を実行している Macbook Pro にダウンロードしてインストールすることにしました。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

unixこれらのエラーを手動で定義して抑制しようとしましたPLATFORMSTL_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 でサポートされていますか? サポートされている場合、何が間違っていますか?

4

1 に答える 1

1

Mac OS X には、検出を試みるUNIX(またはunix、、) マクロはありません。次のように行ステートメントを追加した後、例をコンパイルできました(行154):__unix____unixPlatformSTLdefined(__MACH__)platformstl.h

#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

于 2013-08-23T06:48:26.153 に答える