[antlr-interest] Subclassing from CPPParser
wiggjd at lsbu.ac.uk
wiggjd at lsbu.ac.uk
Tue Dec 23 11:08:15 PST 2003
I am trying to place all our project code in a subclass of
CPPParser but I cannot get the subclassing to work.
I am using MSVC 6.0 with Antlr-2.7.1 to generate (C++) parser
in C++.
After inserting even the bare bones of a subclass I cannot get
rid of the following message,
e:\java\antlr-2.7.1\java-cpp\mycode.cpp(9) : error C2512:
'CPPParser' : no appropriate default constructor available
All the help file says is,
"No default constructor was available for the specified class,
structure, or union.
The compiler will supply a default constructor only if
user-defined constructors are not provided. If you provide a
constructor that takes a nonvoid parameter, then you must also
provide a default constructor. The default constructor can be
called with no parameters, that is, a constructor with default
values for all parameters."
Helpful, isn't it!
However, if I supply a default constructor for CPPParser I
then get a similar message for LLkParser but this doesn't
happen without the Mycode subclass!
I would be grateful if someone could suggest what I might be
doing wrong.
The subclass code is,
Mycode.hpp
----------
#include "CPPParser.hpp"
class Mycode : public CPPParser
{
Mycode();
};
Mycode.cpp
----------
#include "Mycode.hpp"
Mycode::Mycode()
{
}
main.cpp
--------
#include "CPPLexer.hpp"
#include "CPPParser.hpp"
#include "Mycode.hpp"
Mycode mycode();
or
Mycode *mycode = new Mycode();
Thanks,
David.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list