试着写了个class template,编译错误,说是库文件里有错误,我总不能帮borland debug吧,挺纳闷儿的,请大家看看。
试着写了个class template,编译错误,说是库文件里有错误,我总不能帮borland debug吧,挺纳闷儿的,请大家看看。
我的代码:
//test.h
#include <iostream.h>
template <class T>
class Test
{
private:
T total;
public:
set(T t1, T t2){total = t1 + t2;}
};
编译情况:
D:\C++\code\friends>bcc32 test.h
Borland C++ 5.6 for Win32 Copyright (c) 1993, 2002 Borland
test.h:
Error E2257 C:\Program Files\Borland\CBuilder6\Include\stl/_mbstate.h
52: , expected
Error E2453 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 64: Size of the type '__true_type' is unknown or zero
Error E2453 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 65: Size of the type '__false_type' is unknown or zero
Error E2141 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 68: Declaration syntax error
Error E2141 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 70: Declaration syntax error
Error E2141 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 73: Declaration syntax error
Error E2141 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 77: Declaration syntax error
...........
.h 235: Declaration syntax error
Error E2228 C:\Program Files\Borland\CBuilder6\Include\stl/type_traits
.h 235: Too many error or warning messages
*** 26 errors in Compile ***