Errors when recompiling R20 plugin to R21
-
Hi there!
I am trying to recompile an older Plugin to R21 and am having trouble getting it to build correctly.
My C++ and VisualStudio knowledge is very limited so I might just be making some basic mistakes.
I got the R21 sdk and replaced the demo plugins with the old R20 one.
I am using VS2019, but I switched the Platform Toolkit for the plugin and the frameworks to 2017. (Using VS2019 works fine to compile the R20 plugin with the 2015 toolkit)
When building I get a bunch of syntax errors for the frameworks like:Error (active) E0757 member "maxon::ClassInterface::REF" is not a type name
And I get this error for several places where a global array is modified like
myBaseArray.Append(plugin_id);
:C4834 discarding return value of function with 'nodiscard' attribute
I have searched around for a while but I don't know how to fix this. Do I have to modify the code, or is this an issue stemming from an incorrect setup of the VisualStudio project?
-
I don't know about the first one, but the second one is probably because you're not doing any error handling.
Do something like this:
myBaseArray.Append(plugin_id) iferr_ignore();
or
maxon::Result<void> SomeFunction() { myBaseArray.Append(plugin_id) iferr_return; }
or
void SomeFunction() { iferr_scope_handler { GePrint(err.GetMessage()); return; }; myBaseArray.Append(plugin_id) iferr_return; }
or
iferr (myBaseArray.Append(plugin_id)) { GePrint(err.GetMessage()); }
Cheers,
Frank -
Hey Frank!
That totally fixed the errors I got. (At least like you said the second part).
I can now successfully build the solution.
Thank you!I still kinda would like to know if the other warnings that pop up are a serious issue or if they can be ignored... The build doesn't fail anymore, so it sees not to be too bad.
-
Hi @Boony2000, thanks for reaching out to us.
From R20 to R21, as expectable, changes took place in the API which led to adapt R20 examples to be compiled against the newer API. I recommend having a look at Changes in R21 in our documentation and adapt your code or the demo examples consequently if you copied them straightly from R20.
I'm also a bit puzzled by your last reply where you stated that errors were all fixed but you confirm that warnings are still around. Can you clarify what warnings look like? Can you also provide a little bit of context in your code where the warning it's likely to take place?
Thanks, Riccardo
-
Hi Riccardo!
The successfully building solution still gives me these errors:
They stem from the R21 sdk frameworks, so I assumed they are not stuff that I have to fix necessarily. I interpreted the icon on the left as a "syntax error", but maybe it means something else. -
hi @Boony2000 , these are Visual Studio Intellisense errors which you can safely ignore. If they bother you switch the filter from "Build + Intellisense" to "Build".
Cheers, R