Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Errors when recompiling R20 plugin to R21

    Cinema 4D SDK
    3
    6
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Boony2000
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by fwilleke80

        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

        www.frankwilleke.de
        Only asking personal code questions here.

        1 Reply Last reply Reply Quote 1
        • B
          Boony2000
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • r_giganteR
            r_gigante
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • B
              Boony2000
              last edited by Boony2000

              Hi Riccardo!

              The successfully building solution still gives me these errors:
              bed835a6-1543-4bea-a8d9-306ffe8dd751-image.png
              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.

              1 Reply Last reply Reply Quote 0
              • r_giganteR
                r_gigante
                last edited by r_gigante

                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

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post