C++ code generation, return value type modifiers

General discussions about code engineering

Moderator: Moderators

C++ code generation, return value type modifiers

Postby clinn@harris.com » Wed Oct 05, 2011 9:34 am

Hello,

I am trying to generate code from a class, and get the following errors (representative shown)

Error: Class CssLive::GcsCore::GcsCore_impl: method+GetRssIncomingControlPort() : MessageHandler"*" Incorrect return type modifier
Error: Class CssLive::GcsCore::GcsCore_impl: method+GetRssIncomingControlPort() : MessageHandler"*" has incorrect return type.

I want to return a pointer to a MessageHandler. MessageHandler is an interface stereotyped class in the model, and the type modifier shows as a * (not in quotes) in the dialog box for the operation.

What am I doing wrong?

Thanks,
Chuck
clinn@harris.com
Forum Newbie
Forum Newbie
 
Posts: 8
Posts Rating:0
Joined: Fri Aug 19, 2011 7:23 am

Re: C++ code generation, return value type modifiers

Postby clinn@harris.com » Wed Oct 05, 2011 9:39 am

Oy, I am going to earn my designation of "forum newbie" in a big way now. First of all, my previous error was surely related to the fact that it seems the model was set up for Java, not C++. I had added the C++ profile and mistakenly assumed this would switch to C++ silly me.

Now I have gone into options / project / properties / language / and set C++ to be the default language. I also made up a code generation set that included that class, with C++ as the language of choice (for other's reference - if you can't find the code generation set in the brower, make sure the "show code generation sets" button is selected).

This gives me a new cryptic error when I try to generate code:
----------------------------------------------------
C++ code generation report
----------------------------------------------------
----------------------------------------------------
Generation failed:java.lang.ClassCastException: com.nomagic.uml2.ext.magicdraw.classes.mdkernel.impl.PackageImpl cannot be cast to com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier



I also note that when I do a "check syntax", I get a happy box telling me that my model checks for C++ without errors.

This may be crystal clear to others, but not me. Can anyone set me straight?

Thanks,
Chuck
clinn@harris.com
Forum Newbie
Forum Newbie
 
Posts: 8
Posts Rating:0
Joined: Fri Aug 19, 2011 7:23 am

Re: C++ code generation, return value type modifiers

Postby bhoomchai » Fri Oct 07, 2011 5:57 am

Hello Chuck,

The error message that you found is not usual. Normally, if the "check syntax" says that your model is ok, you shouldn't get any problem generating code from it. This error is prone to be a problem in C++ code engineering. If it is possible, please share your model from which you tried to generate code, so I can take a look at the problem in detail.

By the way, the default language option that you mentioned only effect when you generate code using the "generate code framework" menu. If you generate code using code engineering set, the language of generated code depends on the type of code engineering set that you created.

Best regards,
No Magic Customer Support
bhoomchai
Customer Support
Customer Support
 
Posts: 36
Posts Rating:5
Joined: Thu Jan 21, 2010 12:38 am


Return to Code engineering

Who is online

Users browsing this forum: No registered users and 0 guests