Book a Demo

Author Topic: Unexpected symbol: template  (Read 6816 times)

razzo78

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Unexpected symbol: template
« on: November 16, 2015, 08:30:21 pm »
Hi, i have the following code at the end of my class:

//  boost::serialization
BOOST_CLASS_VERSION(AnalysisScreeningOutput, 1)
//--------------------------------------------------------------------------------
// SAVE
//--------------------------------------------------------------------------------
template<class Archive> void AnalysisScreeningOutput::save(Archive & ar, const unsigned int version) const {
      // note, version is always the latest when saving
      ar & _plateSerialCode;
}

When i try to syncronize by reverse engineering in EA i obtein the following error: "Unexpected symbol: template"

How can I do to bypass this error?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Unexpected symbol: template
« Reply #1 on: November 17, 2015, 09:42:16 am »
I don't know the Boost library well enough to know what BOOST_CLASS_VERSION is meant to be used for.

However, adding the language macro BOOST_CLASS_VERSION() to the EA list will allow that to be skipped. The down side of that is that I'm guessing it's intended to act as the class declaration (with another macro following the members) this solution will just skip it and treat the anything below as a global.
« Last Edit: November 17, 2015, 09:43:03 am by simonm »

razzo78

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Unexpected symbol: template
« Reply #2 on: November 17, 2015, 06:52:21 pm »
Thanks, but i have already added BOOST_CLASS_VERSION to the macro skip.
The problem is to the "template" word.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Unexpected symbol: template
« Reply #3 on: November 18, 2015, 08:11:24 am »
The problem isn't the template word. That's just he first symbol the parser can't evaluate.

Remove 'BOOST_CLASS_VERSION' from the macro list and add 'BOOST_CLASS_VERSION()' to make it skip the parenthesis and arguments too.

razzo78

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Unexpected symbol: template
« Reply #4 on: November 19, 2015, 01:57:07 am »
I did not understand why, but it works! Thx  :)
« Last Edit: November 19, 2015, 02:00:15 am by razzo78 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Unexpected symbol: template
« Reply #5 on: November 19, 2015, 08:50:52 am »
Adding () tells the parser that in addition to skipping the macro symbol itself it needs to skip the following argument list. (Otherwise it would try to parse it as if the macro wasn't there)