Thread View: gnu.g++.help
1 messages
1 total messages
Started by Peter K. Campbell
Fri, 31 Jul 1992 12:48
Template problems
Author: Peter K. Campbell
Date: Fri, 31 Jul 1992 12:48
Date: Fri, 31 Jul 1992 12:48
71 lines
2856 bytes
2856 bytes
Hello out there.
Before I start, some background. I have compiled & installed gcc 2.2.2
& libg++ 2.2 on a sparc-sun-sunos4.1.1, and been using gcc with no
problems on normal C code.
I have just received a package which is meant to be able to compile
in Sabre, Sun & AT&T (2.1) C++, and I've successfully compiled it on
using the latter. I thought that seeing as I like GNU and are just
beginning to learn C++ that I'd have a bit of fun trying to get the
package to work with GNU.
Unfortunately, I didn't even get past the include files before I started
getting errors everywhere. I checked the errors and they all seemed
to be concerned with the one type of construct - something of the form
Template Name<X>
with the error message being:
parse error before `<'
There are a few dozen of these errors - e.g. for
Template Error___You_are_not_compiling_with_vpp<X> {}
They also seem to cause related errors - e.g.
...
Template Vstr<X>
{
Declare:
{
class Vstr<X> : public PVstr
{
public:
// constructors
inline Vstr<X>();
inline Vstr<X>(const o_vstr vstr);
inline Vstr<X>(const Vstr<X>& vstr);
inline Vstr<X>(o_u4b hint);
inline Vstr<X>(o_u4b hint, o_bool ignored);
inline Vstr<X>(const X* data, o_u4b count);
inline Vstr<X>(const X* data, o_u4b count, o_bool ignored);
...
gives "parse error before '<'" for the line with the Template on it,
and
parse error before `X'
for every line starting with inline _except_ the inline Vstr<X>();
No-one around here knows much about templates (and nothing about this form
of template), and there's nothing like this in any of the books I've scanned.
However, as I said above this compiled without problems under AT&T,
which seems to indicate that the code is ok, and seeing as it was all
right under 2.1 I would have expected gcc/g++ 2.2.2 to handle it ok.
So, could anyone please tell me
(1) What this form of template is,
(2) Why is g++/gcc giving all of these parse errors,
(3) If this is a FAQ (& my apologies if it is, like I said, I've
just started learning C++ & only just found this newsgroup)
where can I get the FAQ answers is?
Thanks in advance.
Peter K. Campbell
p.campbell@trl.oz.au.
#include <std.disclaimer>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads