Original Message:
Sent: Mon March 27, 2023 02:55 AM
From: Robert Fromm
Subject: Enum redeclaration conflict during code generation
Hello Markus,
thanks for the feedback.
Basically this would be a solution. Indeed, our architecture defines quite a great amount of enumeration. Indeed yet we did not simulate, so it didn't matter.
As C++ is capable of scoped enumeration since quite some time. I opened a ticket at IBM so let's see what they answer.
Best regards
Robert
------------------------------
Robert Fromm
Original Message:
Sent: Mon March 27, 2023 02:40 AM
From: Markus Nordstrand
Subject: Enum redeclaration conflict during code generation
I am also curious about this. I usually solve it by making the enumeration names unique by adding a suffix. In this case since the name of the ValueType was Enumeration1 and Enumeration 2, I would had named the enumerations Success_1 and Success_2 respectively.
I asked the same question on Burce's forum here and he also makes the names unique.
------------------------------
Markus Nordstrand
Original Message:
Sent: Fri March 24, 2023 04:02 AM
From: Robert Fromm
Subject: Enum redeclaration conflict during code generation
Hello,
I have a problem with enum redeclaration compiler error during simulation.
Basically I have defined two enumeration as ValueTypes:
- Enumeration1 with literals "Success", "ErrorTimeout"
- Enumeration2 with literals "Success", ErrorTimeout"
The code generated (C++) looks like:
enum Enumeration1 {
Success = 0,
ErrorTimeout = 1
};
and
enum Enumeration2 {
Success = 0,
ErrorTimeout = 1
};
Which leads to the compiler error "Redeclaration of 'Success' for the second enumeration. Usually I would solve such problems with defining
enum class Enumeration1 { ...} and enum class Enumeration2 {...}.
Indeed, code is generated from Rhapsody automatically, so how can I activate that the compiler creates scoped enumeration? Is this possible at all?
Best regards
Robert
------------------------------
Robert Fromm
------------------------------