在OS X上的FastFormat [英] FastFormat on OS X

查看:199
本文介绍了在OS X上的FastFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读了一些关于FastFormat,我决定下载并安装在我的Macbook Pro,运行OS X 10.8。我成功地得到FastFormat构建,并运行性能测试。然后我写了一个小测试来检查它是否工作:

After reading a little about FastFormat, I decided to download and install it on my Macbook Pro, running OS X 10.8. I successfully got FastFormat to build, and ran the performance tests. Then I wrote a small test to check whether it works:

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

int main()
{
    return EXIT_SUCCESS;
}



在使用g ++ - 4.7进行编译(并确保所有包含路径

Upon compiling it with g++-4.7 (and making sure that all the include paths were correct), I got compile-time errors, such as the ones below, from 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 来抑制这些错误,但我会收到这些链接器错误:

I tried to suppress these errors by defining unix and PLATFORMSTL_OS_IS_UNIX manually, but I then receive these linker errors:

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

Is FastFormat supported on OS X, and if so, what am I doing wrong?

推荐答案

Mac OS X不提供 UNIX (或 unix __ unix __ __ unix )宏 PlatformSTL 尝试检测。我可以在 platformstl.h 中添加 define(__ MACH __)语句之后编译您的示例154):

Mac OS X does not provide UNIX (or unix, __unix__, __unix) macro which PlatformSTL tries to detect. I was able to compile your example after adding the line defined(__MACH__) statement in platformstl.h like this (line 154):

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

为了抑制未定义符号错误,您可以定义宏 FASTFORMAT_NO_AUTO_INIT

To supress the undefined symbols error you can define macro FASTFORMAT_NO_AUTO_INIT:

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

这篇关于在OS X上的FastFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆