Mail Archives: djgpp/1999/02/06/20:53:43
John Soares wrote:
>
> Hello:
>
> I just downloaded v2.02 and it still does not seem to support
> templates(I mean just plain templates, not the STL library).
Strange, because my DJGPP v2.01 (g++ 2.7.2) from two years ago support
templates. For example, the following simple code compiled with no
errors or warnings and executed as expacted:
===============================================
#include <iostream.h>
template <class T>
class A {
T _t;
public:
A(T t) : _t(t) {}
T t() { return _t; }
};
int main()
{
A<int> x(100);
A<float> y(3.5);
cout << x.t() << "\n" << y.t() << "\n";
return 0;
}
===============================================
> Does v. 2.02 actually support templates or am I still doing something
> wrong.
I suspect that v2.02 (which uses G++ 2.8.x?) would support templates
more than v2.01. But understand that the ANSI C++ standard was adapted
only a little more than a year ago, it is possible that not all of the
standard features are supported in the current implementation.
> I am trying to follow an example in a textbook and getting all
> kinds of syntax errors.
If you can provide a simple sample program that exhibit the error, I
guarantee you will get the problem addressed a lot sooner.
For example:
I tried to compile:
===============================================
/* junk.cc */
void main()
{
}
===============================================
with the command line
===============================================
gxx -Wall junk.cc
===============================================
and got the following error
=================================================================
junk.cc:2: warning: return type of 'main' changed to integer type
=================================================================
What's going on?
--
Weiqi Gao
weiqigao AT a DOT crl DOT com
- Raw text -