R24 compiling issue (error C2220: the following warning is treated as an error)
-
Hello.
I have a problem with compiling the plugin for a R24. The same code which compiles and is performed perfectly for R23 and R25, in R24 when I try to build the project throws an error.
The error is: "error C2220: the following warning is treated as an error".
The source of an error is almost random. The codeline which throw an error for R24, does not do it for R23 and R25.
For example the line like so:C4DGadget* const textA = AddEditText(3000, BFH_SCALEFIT, 0, 10, 0);
If I delete it at all and hit the "build project", the same error appears in entirely another place:
for (Int32 i = 0; i < linkBoxesIDs.size(); ++i) {}
if I delete it too, the error starts to appear another place:
BaseContainer* data = op->GetDataInstance();
etc.
I've check the version of the project tool, sdk(the same as a version of c4d) and my Visual Studio (it is 2019).
The plugin file which was compiled for a R23, shows up in R24. And I would use it in a R24 version of Cinema 4D, but my plugin uses some python code from a C++ and due to some differences in include files for the python in r23 and r24, this python code does not work in R24. So I need to recompile the plugin for the correct version.
Is this a known issue?
-
Hello @yaya,
thank you for reaching out to us. Unfortunately, we cannot tell you exactly what these warnings are since you do not show us the warning message for them and the code example are also too ambiguous for pinpointing the problem.
A warning is an indication from the compiler that something in the code is an 'inadvisable state', but not so bad that is would prevent compilation (opposed to an error which does prevent compilation). Many compilers provide the option to elevate warnings to errors, i.e., the compilation will not be carried out although it technically could be.
The error c2220 is exactly such elevated warning. Depending on your project settings, the elevated warning could be anything from an uninitialized variable to a style error. You must read the console output of the compiler to understand which error has been elevated (the 'Error List' window in Visual Studio is usually not very helpful).
Cinema 4D SDK projects always come with warning elevation enabled since a few versions, you would have to disable that yourself if you wish to do so. The Projecttool also has an option to dial in the strictness with which the Maxon C++ style is being warned for (
stylecheck.level=[0, 1, 2, 3]
), as well as an option to also elevate style warnings to errors (stylecheck.aswarnings=[true, false]
). So, depending on yourprojectdefintion.txt
, your errors could be simply induced by having an incorrect indentation in your code or mixing spaces with tabs.When you are still stuck, you should post your full compiler console output here and more code than
the exact lines, as well as the content of yourprojectdefintion
files. Be aware that for indentation related problems copying and pasting code can modify it since our style guide enforces a two spaces wide tab-character based indentation. Copying and pasting this into the forum will convert these tab-characters into four white spaces each.Ps: Please also remember to flag questions as 'Ask-as-Question' when you want to address the SDK-Team. I have done it for your here.
I hope this helps and cheers,
Ferdinand -
Hi @ferdinand , thank you for your answer.
I've fixed the problem via a simple disabling "threat warnings as errors" to "No" in Project Properties/C++/General.It compiles now, which is cool, but is pretty strange, because I did it early before the asking here.
About the error reasons I still don't know what was causing the problem. Yes, I checked the console output. The error is from there with no more details. Also this c2220 error appears only in VS-project created for a R24 version of Cinema 4D. The same code has no problem in VS-projects for a R23 and R25. Literally: I just copy and paste the same code from here to here. Every project - with the same project settings, same additional libraries dependencies and same C++ version (17).
So in case someone comes across this problem, just disable the "Threat warnings as errors" in your project properties. It should help.
-
Hello @yaya,
without any further questions we will consider this topic as solved by Friday, December the 17th.
Thank you for your understanding,
Ferdinand