Book a Demo

Author Topic: Reverse engineering C++: Virtual base class  (Read 4808 times)

Johan Pettersson

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Reverse engineering C++: Virtual base class
« on: August 29, 2008, 06:29:40 pm »
I try to import a C++ file containing the following:

Code: [Select]
class DerivedClass : virtual public BaseClass
{
...
};

When this is imported/reversed engineered I get an error saying that the "virtual" keyword is not understood in this context.

Does this mean that Enterprise Architect cannot reverse engineer code containing virtual base classes?

I use a trial of Enterprise Architect 7.1 (Corporate) on Windows XP (64bit).

Thanks in advance!

/Johan
« Last Edit: August 29, 2008, 06:53:10 pm by johan.pettersson »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Reverse engineering C++: Virtual base class
« Reply #1 on: September 01, 2008, 08:17:26 am »
It can, and I just copied your example and it did.

There could be something else that's causing the problem, (eg. macros) if you file a support request with sparx systems providing some sample code they should be able to tell you what's going on.

Johan Pettersson

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Reverse engineering C++: Virtual base class
« Reply #2 on: September 01, 2008, 04:08:33 pm »
Thanks Simon!

Then I have probably misunderstood the problem some way. I'll look into it and get back either here or with a support request. Thanks again!

Johan Pettersson

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Reverse engineering C++: Virtual base class
« Reply #3 on: September 01, 2008, 06:23:12 pm »
Hi again,

I certainly misunderstood the problem. The reverse engineering process said:

Quote
Settings\johan.pettersson\Desktop\Assertions.h on line 59.  Unexpected symbol: virtual      
You may need to define a language macro.      

I didn't understand/didn't see the macro part but got stuck on the fact that it seemed to "blame" the virtual keyword in this context. I suppose this really is the case but it is actually a macro that is to blame for screwing up the context  :) The code I supplied was a simplified example (simplifed way to much of course!). It is really the following:

Code: [Select]
class AMACRO DerivedClass : virtual public BaseClass
{
...
};

The AMACRO screwed things up of course and when adding it to "Settings"->"Preprocessor Macros" it worked out fine.

Thanks for your help!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Reverse engineering C++: Virtual base class
« Reply #4 on: September 01, 2008, 07:19:57 pm »
Quote
Hi again,

I certainly misunderstood the problem. The reverse engineering process said:

Quote
Settings\johan.pettersson\Desktop\Assertions.h on line 59.
Unexpected symbol: virtual      
You may need to define a language macro.      
That's because the error message was misleading...  It could have read:

Settings\johan.pettersson\Desktop\Assertions.h on line 59.Unknown symbol: "AMACRO" before unexpected symbol: "virtual".  
You may need to add a macro "AMACRO" for this language "AMACRO"
And been more helpful...

HTH,
Paolo
« Last Edit: September 01, 2008, 07:20:26 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!