FMA FMA - 3 days ago 5
C Question

Including c files in .msg files (Veins)

I'm trying to implement a BSM in Veins 4.4. In order to reach this purpose I would like to import my libasn which are C files (.c and .h ) in the WaveShortMessage.msg in order to populate the BSM.

I tried to import them as follows:


  1. #include "veins/asn/BasicSafetyMessage.h"

  2. #include <veins/asn/BasicSafetyMessage.h>



3.

extern "C" {
#include "veins/asn/BasicSafetyMessage.h"
};


4.

#ifdef __cplusplus
extern "C" {
#endif
#include "veins/asn/BasicSafetyMessage.h"
#ifdef __cplusplus
}
#endif


but it doesn't work. It always returns an error.

Could you suggest the right way to do it? Thanks a lot

Answer

Using a C++ code in the message's definition in OMNeT++ is described in details in OMNeT++ Simulation Manual, chapter 6.5.
You should use cplusplus keyword, for example:

cplusplus {{
extern "C" {
#include "veins/asn/BasicSafetyMessage.h"
};
}}
Comments