Book a Demo

Author Topic: Parse Error Reading C++ code  (Read 7712 times)

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Parse Error Reading C++ code
« on: June 03, 2021, 08:29:23 pm »
Hi All

A few years ago I imported some C++ code into EA, but recently I cannot import the following code (first lines shown only);

#define CCASNDITRACKINGDEVICE_H_HEADER_INCLUDED_C1C2FCD2

#include "CCASTrackingDevice.h"
#include <list>
#include "CCASTrackingTypes.h"
#include "CCASNDIProtocol.h"
#include "CCASNDIPassiveTrackableDevice6D.h"
#include "CCASSerialCommunication.h"


#include <vector>
#include <map>

namespace CCAS {
class
    NDIProtocol;

/** Documentation
    * \brief superclass for specific NDI tracking Devices that use serial communication.
    *
    * implements the TrackingDevice interface for NDI tracking devices (POLARIS, AURORA)
    *
    * \ingroup IGT
    */
class CCAS_IGT_EXPORT NDITrackingDevice :
   public TrackingDevice {
public:

    typedef CCAS::TrackingDeviceType NDITrackingDeviceType; ///< This enumeration includes the two types of NDI tracking devices (Polaris, Aurora).
    typedef CCAS::SerialCommunication::PortNumber PortNumber; ///< Port number of the serial connection
    typedef CCAS::SerialCommunication::BaudRate BaudRate; ///< Baud rate of the serial connection
    typedef CCAS::SerialCommunication::DataBits DataBits; ///< Number of data bits used in the serial connection
    typedef CCAS::SerialCommunication::Parity Parity; ///< Parity mode used in the serial connection

The error received is a Parse error on the lines asking if I would like to create a Language Macro and reparse:

class CCAS_IGT_EXPORT NDITrackingDevice :
   public TrackingDevice {
public:

    typedef CCAS::TrackingDeviceType NDITrackingDeviceType;

C++ is not my first language, but I cannot see anything incorrect with the code above,

Any Ideas

Using EA version 15.2.1559

Phil
Models are great!
Correct models are even greater!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Parse Error Reading C++ code
« Reply #1 on: June 03, 2021, 08:37:57 pm »
I see a lot of "{" but not a single "}"

C++ is a LONG time ago for me, but that doesn't seem right does it?

Geert

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Parse Error Reading C++ code
« Reply #2 on: June 04, 2021, 12:11:32 am »
Hi Geert

Thanks for your reply I only posted the lines up to the point where the parse error occurred, hence the { are shown but the matching } are not shown in the post but they are they are there in the code for sure. The complete code is a bit long to post here.

Sorry for the confusion!

Phil
Models are great!
Correct models are even greater!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Parse Error Reading C++ code
« Reply #3 on: June 04, 2021, 01:18:58 am »
I would guess that you need to define a macro for CCAS_IGT_EXPORT so EA knows that it is one.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Parse Error Reading C++ code
« Reply #4 on: June 04, 2021, 08:56:16 am »
Yep, my guess is you need to define CCAS_IGT_EXPORT. Which would make the parse error say that 'NDITrackingDevice' was the symbol it failed on.

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Parse Error Reading C++ code
« Reply #5 on: June 04, 2021, 06:55:31 pm »
Thanks q and Eve

Your notes allowed me to focus on that area of the code and I did discover the error, the line

class CCAS_IGT_EXPORT NDITrackingDevice :

Contains a space in the class name! I just didn't see it, so changing the above to:

class CCAS_IGT_EXPORT_NDITrackingDevice :

Makes the import work perfectly.

Thanks for all you help

Phil
Models are great!
Correct models are even greater!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Parse Error Reading C++ code
« Reply #6 on: June 07, 2021, 09:05:34 am »
I think that you'll find that somewhere in your code or project
Code: [Select]
CCAS_IGT_EXPORT was defined to something like
Code: [Select]
__declspec(import) or
Code: [Select]
__declspec(export) (depending on if the header is imported within the project defining that class or a project using it). I would expect the change you've made will stop the code from compiling.

Enterprise Architect is able to skip over macros that you tell it about, but it doesn't read the defines and evaluate them.