相关疑难解决方法(0)

为什么iostream包含time.h?

考虑以下代码:

#include <iostream>

template<class C>
struct time { };

int main() { }
Run Code Online (Sandbox Code Playgroud)

它产生(GCC 4.5):

error: ‘template<class C> struct time’ redeclared as different kind of symbol
/usr/include/time.h:186:15: error: previous declaration of ‘time_t time(time_t*)’
Run Code Online (Sandbox Code Playgroud)
  1. 为什么iostream包含time_t time(time_t*)
  2. 为什么iostream包含time_t time(time_t*)外部std命名空间?
  3. (未答复)为什么,如果我删除template<class C>,我不会收到此错误?

c++ namespaces compiler-errors std

5
推荐指数
1
解决办法
3100
查看次数

标签 统计

c++ ×1

compiler-errors ×1

namespaces ×1

std ×1