Convert IDL with multiple #include

9 posts / 0 new
Last post
Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25
Convert IDL with multiple #include

I have an IDL that has mutliple #include and some of the "#include" has other embedded #include.

For example: 

Main.idl:

 

#include "Types.idl"

#include "Enums.idl"

#include "Submain.idl"

struct MainICD { ...... }

The "Submain.idl" also has #include to "Types.idl", "Enums.idl".

When I use the converter to try to convert, it has a problem with converting the Submain and Main due to references in the type to the other idl file(s). 

Is there any way to ensure this get converted correctly?

Howard's picture
Offline
Last seen: 18 hours 24 min ago
Joined: 11/29/2012
Posts: 610

What do you mean "use the converter"?  What is "the converter"?  What are you trying to convert to?  What is the problem?  Are there error messages that you can share?

Marc.Chiesa's picture
Offline
Last seen: 2 years 9 months ago
Joined: 07/24/2017
Posts: 32

Hi Tan,

Are you using  #pragma once or  #ifndef guards in your IDL files? Without one of these guards you may get errors during codegen for previously defined symbols. 

For example, in types.idl:

#ifndef __TYPES_IDL__

#define __TYPES_IDL__

// define your types here

#endif

or using the pragma in types.idl:

#pragma once

// define your types here

Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25

I'm using the RT DDS Gen - Type Converter. I do have #ifdef JAVA .... #endif in the idl. Here's the command that's executed: /opt/rti_connext_dds-5.3.0/bin/rtiddsgen -ppDisable -d /home/user1/Desktop/IDLs/XML -convertToXml /home/user1/Desktop/IDLs/idl/[filename].idl. This is failling due to error with type references not found. 

ERROR com.rti.ndds.nddsgen.Main VehicleLoiter.idl line 75:8 member type 'types::MeasurementSet' not found
ERROR com.rti.ndds.nddsgen.Main Fail: java.lang.Exception: The file couldn't be parsed and the rawTree wasn't generated
INFO com.rti.ndds.nddsgen.Main Done (failures)

Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25

At the top of the idl, I have the #ifndef ___[TYPES]__IDL___

and #define ___[TYPES]__IDL___

Marc.Chiesa's picture
Offline
Last seen: 2 years 9 months ago
Joined: 07/24/2017
Posts: 32

-ppDisable disables the use of the preprocessor which is required to process #include statements. If you remove that option does it convert successfully?

If you are using the GUI utility, there should be a check box next to the "Input file format" drop down that allows you to turn the preprocessor back on.

Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25

Here's the error I'm getting without the flag check.

INFO com.rti.ndds.Main Running rtiddsgen version 2.5.0, please wat ...

ERROR com.rti.ndds.nddsgen.IDLPreprocessor cpp: error trying to exec 'cclplus': execvp: No such file or directory

I have the standard gcc package install

Marc.Chiesa's picture
Offline
Last seen: 2 years 9 months ago
Joined: 07/24/2017
Posts: 32

Are you able to install the g++ package on this host as well? That should resolve the missing cc1plus issue.

Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25

Thanks! That works. Once I had the required g++, I was able to convert it without any issues.