SOLVED
It's just static NodeData *Alloc() { return NewObjClear(SoloPrefs); }
Best posts made by Yakuza
-
RE: Allocation of PrefsDialogObject
-
RE: Plug-in running fine on one OS but not another
Yes. it's solved. Thank you.
Latest posts made by Yakuza
-
RE: Legacy Code still a thing?
@ferdinand
Thank you very much. I don't get a lot of that but was able to change the flow/logic of the plugin so that the compiler doesn't throw any errors anymore (but a bazillion warnings ). I have no idea if this will work because I still cannot test it since actually it's two plugins, the command plugin and its preferences dialog. The latter is unfortunately larger than the command itself and still throws 21 errors.They all occur in PrefsDialogObject class. Do you have any ideas on these?
Severity Code Description Project File Line Suppression State Error C4263 'Bool SoloPrefs::Init(GeListNode *)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 134 Error C4264 'Bool NodeData::Init(GeListNode *,Bool)': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 146 Error C4263 'Bool SoloPrefs::GetDParameter(GeListNode *,const DescID &,GeData &,DESCFLAGS_GET &)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 135 Error C4264 'Bool NodeData::GetDParameter(const GeListNode *,const DescID &,GeData &,DESCFLAGS_GET &) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 146 Error C4263 'Bool SoloPrefs::GetDEnabling(GeListNode *,const DescID &,const GeData &,DESCFLAGS_ENABLE,const BaseContainer *)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 137 Error C4264 'Bool NodeData::GetDEnabling(const GeListNode *,const DescID &,const GeData &,DESCFLAGS_ENABLE,const BaseContainer *) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 146 Error C4263 'Bool SoloPrefs::GetDDescription(GeListNode *,Description *,DESCFLAGS_DESC &)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 138 Error C4264 'Bool NodeData::GetDDescription(const GeListNode *,Description *,DESCFLAGS_DESC &) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 146 Error C2664 'Bool SoloPrefs::InitValues(const DescID &,Description *)': cannot convert argument 1 from '<unnamed-enum-PREF_SOLOPREFS_MAIN_GROUP>' to 'const DescID &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 210 Error C2440 '<function-style-cast>': cannot convert from 'initializer list' to 'GeData' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 230 Error C2664 'Bool SoloPrefs::InitValues(const DescID &,Description *)': cannot convert argument 1 from '<unnamed-enum-PREF_SOLOPREFS_MAIN_GROUP>' to 'const DescID &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 272 Error C2440 'return': cannot convert from 'const BaseContainer *' to 'BaseContainer *' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 287
-
RE: Legacy Code still a thing?
Thank you, Ferdinand. Yes, I did that already and changed the first bc to const. Your link says btw.:
" Note -Legacy code will compile and run without adaptions but adhering to these changes will yield performance improvements."Now there are 10 instances of error 3 above.
-
RE: Legacy Code still a thing?
Thank you. It's actually "only" 26 errors on compilation. They are mostly BaseContainer related, to no surprise, since the plugin does largely only handle containers and their values. See console output below.
So if you for starters could nudge me regarding
cannot convert from 'const BaseContainer * to 'BaseContainer* and
cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &
I might be half way done.Error1 - Lines 51ff look like this
Int32 SOLO::GetState(BaseDocument *doc, GeDialog* parentManager) { BaseContainer *bc = doc->GetDataInstance()->GetContainerInstance(SOLO_ID); if (!bc) return CMD_ENABLED; else if (bc->GetInt32(ID_SOLO_SET, 0) == 0) return CMD_ENABLED; else return CMD_ENABLED | CMD_VALUE; }
Error3 - Line 181
obj->GetDataInstance()->GetContainerInstance(SOLO_ID)->SetInt32(ID_SOLO_STATE, data);
Any pointers to pointers and constant containers would be welcome.
Cheers,
Bo
Severity Code Description Project File Line Suppression State
Error C2440 'initializing': cannot convert from 'const BaseContainer *' to 'BaseContainer *' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 53
Error C4996 'BaseList2D::GetData': Use GetDataInstanceRef() to avoid the unnecessary BaseContainer copy solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 109
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 181
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 182
Error C2662 'void BaseContainer::SetBool(Int32,Bool)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 183
Error C4263 'Bool SoloPrefs::Init(GeListNode *)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 133
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 199
Error C4264 'Bool NodeData::Init(GeListNode *,Bool)': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 145
Error C4263 'Bool SoloPrefs::GetDParameter(GeListNode *,const DescID &,GeData &,DESCFLAGS_GET &)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 134
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 200
Error C4264 'Bool NodeData::GetDParameter(const GeListNode *,const DescID &,GeData &,DESCFLAGS_GET &) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 145
Error C4263 'Bool SoloPrefs::GetDEnabling(GeListNode *,const DescID &,const GeData &,DESCFLAGS_ENABLE,const BaseContainer *)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 136
Error C2662 'void BaseContainer::SetBool(Int32,Bool)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 201
Error C4264 'Bool NodeData::GetDEnabling(const GeListNode *,const DescID &,const GeData &,DESCFLAGS_ENABLE,const BaseContainer *) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 145
Error C4263 'Bool SoloPrefs::GetDDescription(GeListNode *,Description *,DESCFLAGS_DESC &)': member function does not override any base class virtual member function solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 137
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 208
Error C4264 'Bool NodeData::GetDDescription(const GeListNode *,Description *,DESCFLAGS_DESC &) const': no override available for virtual member function from base 'NodeData'; function is hidden solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 145
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 209
Error C2662 'void BaseContainer::SetBool(Int32,Bool)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 210
Error C2440 'initializing': cannot convert from 'const BaseContainer *' to 'BaseContainer *' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 228
Error C2662 'void BaseContainer::SetInt32(Int32,Int32)': cannot convert 'this' pointer from 'const BaseContainer' to 'BaseContainer &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\solo2023.cpp 260
Error C2664 'Bool SoloPrefs::InitValues(const DescID &,Description *)': cannot convert argument 1 from '<unnamed-enum-PREF_SOLOPREFS_MAIN_GROUP>' to 'const DescID &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 209
Error C2440 '<function-style-cast>': cannot convert from 'initializer list' to 'GeData' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 229
Error C2664 'Bool SoloPrefs::InitValues(const DescID &,Description *)': cannot convert argument 1 from '<unnamed-enum-PREF_SOLOPREFS_MAIN_GROUP>' to 'const DescID &' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 271
Error C2440 'initializing': cannot convert from 'const BaseContainer *' to 'BaseContainer *' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 278
Error C2440 '=': cannot convert from 'const BaseContainer *' to 'BaseContainer *' solo2023 D:\MAXON_CODE\C4D_2024_2_CODE\sdk\plugins\solo2023\source\SoloPrefs.cpp 282 -
Legacy Code still a thing?
Hi.
I just tried to compile a simple plugin for 2024 whose code basically worked for the last 16 years. Now it throws 40 errors.
Has the time come for an inevitable re-write or should it continue to work and it's just a matter of fixing some stuff?
Cheers
-
RE: Plug-in running fine on one OS but not another
Yes. it's solved. Thank you.
-
RE: Plug-in running fine on one OS but not another
@kbar said in Plug-in running fine on one OS but not another:
I was reading through this to see if you used a Debug build. Glad you finally found it. I assume what you were doing was compiling on one machine in Debug mode and then just copying the plugin to your second machine to try it out. That second machine wouldn't have had Visual Studio installed so it wouldn't have had the debug runtime dlls, so your plugin wouldn't have loaded. Always compile in Release mode if you are going to test your plugin on another machine, or if you are giving the plugin to someone to test out.
That's exactly what happened. Thanks.
-
RE: Plug-in running fine on one OS but not another
OK, it's working now. I changed two things but probably what did the trick was the latter: I updated Visual Studio and compiled a Release build. The shakey one was Debug config which I totally missed until after the update. FYI I'm using the Community Edition. You can re-download via the above link and test 2023.0.1. and 2023.1.0 again if you are interested. Here it's running just fine in both versions incl. prefs.
Cheers!
-
RE: Plug-in running fine on one OS but not another
Yup, very odd. BTW on the failing OS neither the locally installed 2023.0.1. loads the plugin nor the installation that is installed on the other OS and works there does.