Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Use of undeclared identifier 'FORCE_TYPE'

 Post Reply Post Reply
Author
Message
evgenyp View Drop Down
Member
Member


Joined: 2017 Mar 25
Online Status: Offline
Posts: 30
Post Options Post Options   Quote evgenyp Quote  Post ReplyReply Direct Link To This Post Topic: Use of undeclared identifier 'FORCE_TYPE'
    Posted: 2018 Jan 08 at 9:27pm

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!

Back to Top
WickedP View Drop Down
Member
Member
Avatar

Joined: 2011 Aug 21
Online Status: Offline
Posts: 470
Post Options Post Options   Quote WickedP Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 08 at 10:40pm
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.
WickedP® Developer
http://www.wickedp.com
Back to Top
evgenyp View Drop Down
Member
Member


Joined: 2017 Mar 25
Online Status: Offline
Posts: 30
Post Options Post Options   Quote evgenyp Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 08 at 11:14pm
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!

Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 195
Post Options Post Options   Quote knickknack Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 09 at 2:59am
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
MAXON Computer GmbH
SDK Support Team
Back to Top
evgenyp View Drop Down
Member
Member


Joined: 2017 Mar 25
Online Status: Offline
Posts: 30
Post Options Post Options   Quote evgenyp Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 09 at 3:05am
Thanks for the remark) But what to return?
Back to Top
knickknack View Drop Down
Forum Moderator
Forum Moderator


Joined: 2016 Jul 01
Location: Italy
Online Status: Offline
Posts: 195
Post Options Post Options   Quote knickknack Quote  Post ReplyReply Direct Link To This Post Posted: 2018 Jan 09 at 4:13am
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
MAXON Computer GmbH
SDK Support Team
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.