Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Use of undeclared identifier 'FORCE_TYPE'

    SDK Help
    0
    6
    982
    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.
    • H
      Helper
      last edited by

      On 08/01/2018 at 21:27, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   18 
      Platform:      Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Greetings of all! Help with a mistake please! I started studying C ++ and I'm converting a python plugin into C ++. What am I doing wrong?

      //Connector (Dynamic) Object
      
      BaseObject\* suspcon = BaseObject::Alloc(180000011);
      

      suspcon->InsertAfter(cubet);
              suspcon->SetName( "Suspension Con " + op->GetName() );
              
              BaseContainer* suspconBC = suspcon->GetDataInstance();
              
              suspconBC->SetData(FORCE_TYPE, 9);

      FORCE_TYPE = Xcode tells me "Use of undeclared identifier 'FORCE_TYPE'"
      All problems are connected with the Connector))) I suspect that I do not understand something about this))) Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 08/01/2018 at 22:40, xxxxxxxx wrote:

        Hi evgenyp,

        I don't recognise that particular flag. But just a thought, have you included the necessary header file? Looks like it might be dyninteraction.h

        WP.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 08/01/2018 at 23:14, xxxxxxxx wrote:

          Thanks, I added #include "dynconstraintobject.h" and
          #include "dyninteraction.h" everything works! Honestly I did not think that the files will be called so))) Thank you!

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 09/01/2018 at 02:59, xxxxxxxx wrote:

            Hi  evgenyp, thanks for writing us.

            Beside the missing header needed to fix the undeclared identifier, considering you're moving the first steps in the C++ arena, it's always a recommended practice to check your memory allocation before using any of them.

            Specifically i'd suggest to review the code and include:

              
            BaseObject* suspcon = BaseObject::Alloc(180000011);  
            if (suspcon == nullptr)  
              return; // beware to return the "proper" value which your function is expected to return in case something fails  
              
            suspcon->InsertAfter(cubet);  
              
            suspcon->SetName("Suspension Con " + op->GetName());  
              
            BaseContainer* suspconBC = suspcon->GetDataInstance();  
            if (suspcon == nullptr)  
              return; // beware to return the "proper" value which your function is expected to return in case something fails  
              
            suspconBC->SetData(FORCE_TYPE, 9);  
            

            Best, Riccardo

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 09/01/2018 at 03:05, xxxxxxxx wrote:

              Thanks for the remark) But what to return?

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 09/01/2018 at 04:13, xxxxxxxx wrote:

                Hi evgenyp, actually depends on how you've defined the function/method to which this code belongs to.
                Maybe it's worthy to have a look here where functions are briefly explained together with return values.

                Best, Riccardo

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