Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2639
  • 博文数量: 1
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 12
  • 用 户 组: 普通用户
  • 注册时间: 2016-12-02 09:21
文章分类
文章存档

2016年(1)

我的朋友
最近访客

分类: C/C++

2016-12-02 09:34:36

原文地址:too few template-parameter-lists 作者:xfavorx

   
    今天动手编程,在用template时出现以下问题:

    graph.h:274: error: too few template-parameter-lists

    原来这是一个gcc版本导致的问题,我参照的是某先人97年的程序,我的4.1.3版本的gcc却不认识了。找了一圈,在这里找到了答案:

    以下将这个例子摘录:

#include <iostream>
using namespace std;

template <typename T>
class testClass
{
public:
static int _data;
};

int testClass<int>::_data = 1;

int main()
{
cout << testClass<int>::_data << endl;
return 0;
}


    在g++-3.3以下的版本可以编译通过
    而在3.4以后的版本必须写作 template int testClass::_data = 1;
阅读(551) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~