Parse error before `{' - superclass inheritance problem

Dave Mason dmason____transat-tech.com
Tue Aug 27 23:41:43 CEST 2002


This is an old one, but I had this problem too when I first started 
using Agent++, so I thought I'd pass the answer along for whoever may 
run into it next.  It was very difficult to track down, but the solution 
turned out to be simple.  When you run AgentGen, it asks which version 
of Agent++ you're using.  When I first installed it, the default version 
was Agent++ v3.4.  I was using v3.5, and I forgot to change the version 
to v3.5.  The difference in the generated code is that v3.4 does not use 
the Agentpp namespace, which v3.5 expects unless you tell it otherwise. 
 When you try to compiled the v3.4 code without the namespace in a v3.5 
environment, you get the parse error.

Dave

-----Original Message-----
From: Kjersti Grønnevik
Sent: 25. februar 2002 11:25
To: agentpp-dl____agentpp.com
Subject: Parse error before `{' - superclass inheritance problem

Hi,
I am using Agent++3.4, Snmp++2.6 (and AgentGen) for unix on Linux Redhat 
6.2 with KDevelop and Cygwin on a winNT pc.
The agentGen seemed to create the mibfiles ( myMib.h and myMib.cpp) 
correctly.
when I try to compile and make the files in KDevelop I get a mysterious 
error message:
In file included from myMib.cpp:7:
myMib.h:194:parse error before `{'
In myMib.h at line 194 it says:
class lvGeneralAgentName: public MibLeaf{
.....
As far as I can see the MibLeaf class is decleared in mib.h under 
Agent++/includes (and mib.h is also included at the top of myMib.h -
#include <mib.h> )
I have also added the include directorys for Agent++ and Snmp++ in the 
project's options - compiler options and
made lib files for the src files for Snmp++ and Agent++
I have written code with bad syntax in the MibLeaf class in mib.h to see 
if the compiler checked the mib.h at all, and the bad syntax was detected.
I have created a new class in mib.h and a new class in myMib.h that 
inheritad the class in mib.h and the same error came:

mib.h: class Dill{};
myMib.h: class Dall: public Dill{};

In file included from myMib.cpp:7:
myMib.h:190:parse error before `{'
myMib.h:194:parse error before `{'

For me it seems that the problem is inheritance between mib.h and myMib.h
and it's a bit strange since the code in myMib.h and myMib.cpp are 
created by AgentGen.
I would appreciate every help or hint I can get!

Kind regards,
Kjersti





More information about the AGENTPP mailing list