Book a Demo

Author Topic: forward declaration of classes and enums (C++)  (Read 3160 times)

jst

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
forward declaration of classes and enums (C++)
« on: September 07, 2006, 04:41:58 am »
Hi,

I've got a question to the code generator for C++ headers.

I defined a class within my model which has an enum and another classes as parameters in some Operations (methods).

The problem is, that the enum an the referenced classes are not included or declarated at the top of the headerfile. The enum is define in the SAME headerfile, but AFTER the class declaration.
So the compiler is not able to compile at all.

I put a codesnippet to explain that:

//--------------------------------------------------------------------
// used classes and enums (these lines are not generated by EA :-( )
enum  myClassTypes;
class myOtherClass1;
class myOtherClass2;
//--------------------------------------------------------------------

class myClass
{
public:
  // Constructor / Destructor
  (...)

  /*---------------------------------------------------------------------------*/

  virtual myClassTypes getType(void) const = 0;

  static bool overlapCheck(const myOtherClass1 * in1, const myOtherClass2 * in2);
};

/**
* Enum declares all existing types
*/
enum myClassTypes
{



/**

* Type1

*/

C_T_1,



/**

* Unknown type

*/

C_T_U
};

When I add the lines between the comments above into the imports section of the class it works fine, but I think EA should do that automatically.

Thanks for reply,
jst

PS: I'm using newest version of EA (796)

Jan ´Bary´ Glas

  • EA User
  • **
  • Posts: 408
  • Karma: +0/-0
  • Bary
    • View Profile
Re: forward declaration of classes and enums (C++)
« Reply #1 on: September 07, 2006, 04:45:11 am »
Quote
PS: I'm using newest version of EA (796)

The newest is 6.5.797 (from today)  ;)
Jan 'Bary' Glas