TEMPLATES, PARSE ERRORS !! PLEASE HELP !!

Abhijit Karmarkar abhijit@it.iitb.ernet.in
Sat Apr 29 00:13:00 GMT 2000


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

THANX. IN ADVANCE...........


************** problem code structure **************


[Parent Class ------------]

template <class LocalInfo, class GlobalInfo>
class StateSpaceSearch {
	...
	...
protected:
	// Protected member data
	StateSpace< State<LocalInfo, GlobalInfo> >* graph;

	...
	...
public:
	StateSpaceSearch() { graph = NULL; showTestSetPerf = showBestOnly;}
        virtual ~StateSpaceSearch() { delete graph; }
	...
	...
}


[SubClass -----------------]

template <class LocalInfo, class GlobalInfo>
class BFSearch : public StateSpaceSearch<LocalInfo, GlobalInfo> {
	NO_DEFAULT_OPS(BFSearch);
	......
	..
protected:
	virtual Bool terminate() {
		...
		
		ASSERT(graph->get_num_states() >= 0); // Parse Error before '->'
		...
		...
	}



public:
	....
	search(State<LocalInfo, GlobalInfo>* initialState, GlobalInfo *gInfo,
       		const MString& displayFileName) {
		...
		...
		delete graph;  // Parse Error Before ';'
		graph = new StateSpace< State<LocalInfo, GlobalInfo> >;
	        graph->set_log_level(get_log_level()-1); // AGAIN Parse Error
	...
	.....
	...
}



                         ''~``
                        ( o o )
+------------------.oooO--(_)--Oooo.------------------+
| Abhijit Karmarkar                                   |
| Student, M.Tech in Information Tech., Sem 2         |
| School Of Information Tech.                         |
| Indian Institute of Technology, Bombay.             |
| email : abhijit@it.iitb.ernet.in                    |
|                    .oooO                            |
|                    (   )   Oooo.                    |
+---------------------\ (----(   )--------------------+
                       _)    ) /
                             (_/




More information about the Gcc-help mailing list