We compile the following code with gcc (historically 2.95.3, egcs-2.91.66 or VC5/6 on Windows).

template<class X> class mapTags {
public:
 typedef void (X::*thisfunc)();
 static commandTags<X> mustags[];

 std::map<string, thisfunc> quickfindtag;
// Looks up function call for this name, and does it, if defined
 int doCommand(X* thisclass, const char* funcname)
 {
   // See Stroustrup III, p 420
   commandTags<X>* tags = mustags;
   if (quickfindtag.empty()) {
     // fill quickfindtag map with all the entries in mustags array
     while (tags->name != NULL) {
quickfindtag.insert(std::pair<string, thisfunc >(tags->name, tags->func)); ++tags;
     }
   }
// find tag in quickfindtag map

std::map<string, thisfunc>::const_iterator functionIterator = quickfindtag.find(funcname);

   if (functionIterator != quickfindtag.end()) {
     thisfunc func = functionIterator->second;
     (thisclass->*func)();   // run function
     return 1;
   }
   return 0; // function not found
 }
};

I have just installed Fedora Core 4 and am trying to compile it with gcc 4.0.0 (Redhat 4.0.0-8). However I get the error message:

FmDisplay.h: In member function 'mapTags<X>::doCommand(X*, const char*)'
FmDisplay.h:61: error: expected `;' before 'functionIterator'
FmDisplay.h:62: error: 'functionIterator' was not declared in this scope

I do not know why this is happening. I installed gcc 2.95.3 and got exactly the same error message so it is possibly to do with the Fedora installation rather than gcc.

The same code compiles ok on Solaris 5.6/7 with egcs-2.91.66 and on Redhat 8.0 with gcc 2.95.3.

Thanks in advance.

Mike

--
___________________________________________________ Michael Gatford
Senior Technical Consultant
___________________________________________________ APR Smartlogik Limited.
Rustat House - Clifton Road - Cambridge - CB1 7EJ
phone +44 (0)1223 27 1025
fax   +44 (0)1223 27 1010
map: http://www.aprsmartlogik.com/contact/CambridgeMap.pdf

mailto:[EMAIL PROTECTED] http://www.aprsmartlogik.com/
***********************************************************************
This e-mail may contain proprietary and confidential information and is intended for the recipient(s) only. If an addressing or transmission error has misdirected this e-mail, please notify the systems administrator by forwarding this e-mail to mailto:[EMAIL PROTECTED] If you are not the intended recipient(s) disclosure, distribution, copying or printing of this e-mail is strictly prohibited.
***********************************************************************

Reply via email to