2016-04-08 103 views
2

我在一类这个代码调用ctime奇怪的错误,当试图建立

#include <__config> 
#include <time.h> 

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 
#pragma GCC system_header 
#endif 

_LIBCPP_BEGIN_NAMEPSACE_STD 

using ::clock_t; 
using ::size_t; 
using ::time_t; 
using ::tm; 
using ::clock; 
using ::difftime; 
using ::mktime; 
using ::time; 
using ::asctime; 
using ::ctime; 
using ::gmtime; 
using ::localtime; 
using ::strftime; 

_LIBCPP_END_NAMESPACE_STD 

但我不断收到这些错误:

errors

任何人都知道是什么问题?

回答

2

所以,我找到了答案,这是可能是因为我有一个名为time.h的头部框架,它是保存名称。我将我的文件更改为mytime.h并完美编译。

2

问题可能与C++的编译时

你可以尝试以下方法标准库未找到:

  • 添加一个空.mm文件到你的项目! 确保C++标准库设置为++(GNU C++标准库)
    参考的libstdc在构建设置:https://stackoverflow.com/a/19250215/4557505
    其他
  • 添加-lstdC++到其它链接器标记!在构建设置
    其他
  • 添加的libstdC++ dylib/TBD和libstdC++ 6.dylib/TBD在构建阶段 - >链接二进制与图书馆