This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: TEMPLATES, PARSE ERRORS !! PLEASE HELP !!


On Sat, 29 Apr 2000, Abhijit Karmarkar wrote:

Please do not shout. Text in all caps is difficult to read. 
  Also, some people protect themselves against spam by deleting any email
  which has a subject line in all caps.

Please note that gcc@gnu.org is primarily for developers of gcc, not for
  questions about using gcc. Likewise, gcc-help is for help with problems
  specific to gcc. (I am not sure what your problem is, but it does not
  seem specific to gcc.)

C++ questions should be addressed to comp.lang.c++.moderated, or
  some other c++ forum; niether of these lists is for teaching people c++. 

> Hi !
> 
> Iam compiling a c++ program (whose structure i've added below), on Linux
> (RedHat 6.1), with gcc 2.95.2.
> 
> Iam getting "parse error" while accessing data members of
> the superclass. something to do with templates I suppose...
> 
> 
> more specifically i've a pointer var "graph" in parent class
> (StateSpaceSearch), which iam referring to in it's  subclass (BFSearch)
> when ever i try to graph->someMetho(), iam getting a parse error !!
> (please c the code structure below..., i've added comment where error is
> occuring)
> 
> 
> WHAT'S THE PROBLEM... CAN'T I ACCESS PARENT MEMEBER ??????!!!!!
> 
> 
> PLEASE HELP........... IAM NOT ABLE TO COMLETE MY PROJECT BECAUSE OF THIS
> MYSTERIOUS ERROR OF WHICH I HAVE NO CLUE........
> last date for my project is 30th April.......
> 
> 
> PLEASE HELP !!!!!!!!!!!!!!!!!!!!!!!!
> 
> i would be thankful is u mail be directly at 
> 
> abhijit@it.iitb.ernet.in

Please do not reply to gcc or gcc-help; these lists are not for c++
  questions.

> 
> THANX. IN ADVANCE...........
> 
> 
> ************** problem code structure **************
> 
> 
> [Parent Class ------------]
> 
> template <class LocalInfo, class GlobalInfo>
> class StateSpaceSearch {
> 	...
> 	...
> protected:
> 	// Protected member data
> 	StateSpace< State<LocalInfo, GlobalInfo> >* graph;
        ^^^^^^^^^   ^^^^^

Where is 'StateSpace' defined? Where is 'State' defined? What *are* they?
If you can answer these questions, I imagine the source of many of your
  errors will become clear.

> 
> 	...
> 	...
> public:
> 	StateSpaceSearch() { graph = NULL; showTestSetPerf = showBestOnly;}
>         virtual ~StateSpaceSearch() { delete graph; }
> 	...
> 	...
> }
^^^
You need a semicolon (;) at the end of every class declaration.

> 
> 
> [SubClass -----------------]
> 
> template <class LocalInfo, class GlobalInfo>
> class BFSearch : public StateSpaceSearch<LocalInfo, GlobalInfo> {
> 	NO_DEFAULT_OPS(BFSearch);
        ^^^^^^^^^^^^^^

What is 'NO_DEFAULT_OPS' ? If it is supposed to a function, it needs a
  return type.

> 	......
> 	..
> protected:
> 	virtual Bool terminate() {
                ^^^^

What is 'Bool'? If you mean the ISO C++ type 'bool', note that it is in
  all lowercase, like all C++ keywords.

> 		...
> 		
> 		ASSERT(graph->get_num_states() >= 0); // Parse Error before '->'

This is likely a cascade error caused by errors in the definition of
  'graph'; see above.

> 		...
> 		...
> 	}
> 
> 
> 
> public:
> 	....
> 	search(State<LocalInfo, GlobalInfo>* initialState, GlobalInfo *gInfo,

'search' must have a return type.

>        		const MString& displayFileName) {
                              ^^^^^^^

What is an 'MString'?

> 		...
> 		...
> 		delete graph;  // Parse Error Before ';'

Again, this is probably a cascade error caused by errors in the definition
  of graph.

> 		graph = new StateSpace< State<LocalInfo, GlobalInfo> >;
> 	        graph->set_log_level(get_log_level()-1); // AGAIN Parse Error

Here too.

> 	...
> 	.....
> 	...
> }

You are missing a close curly brace (}).

Do not forget the semicolon at the end of the class declaration.

[snip]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]