首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

SunOS 5.10 CC 5.3编译有关问题

2013-04-20 
SunOS 5.10CC 5.3编译问题本帖最后由 smallnat 于 2013-04-07 22:59:21 编辑class A{public:template typ

SunOS 5.10 CC 5.3编译问题
本帖最后由 smallnat 于 2013-04-07 22:59:21 编辑

class A
{
public:
        template <typename T>
        void func(const T& t)
        {
        }
};

namespace TL
{
        class B
        {
        };
};

int main()
{
        A* pa = new A;
        TL::B b;
//      A a = *pa;
//      a.func(b);
        pa->func<TL::B>(b);

        return 0;
}


编译命令及错误:
CC -o test -g test.cpp
"test.cpp", line 23: Error: Unexpected type name "TL::B" encountered.
1 Error(s) detected.


CC编译器版本:
CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15

c++?SunOS?CC C++ SunOS
[解决办法]
代码没问题,编译器不给力。
[解决办法]

using namespace TL;
然后再
pa->func<B>(b);
看看能不能过

热点排行