I've been developing Cinema 4D plugins using the Python API for a long time, and have attempted (but often struggled) to do development with Cinema 4D's C++ API. One of my biggest stumbling blocks was just getting the example plugins to compile. So, in this post, I'm going to try and catalog the steps I've taken to get this working.
I'm making extensive use of the Cinema 4D C++ SDK Documentation, and it should be seen as the definitive source of the information I'm providing in a simplified format here. Specifically, I found the following pages/articles quite helpful:
I am by no means an expert, and I will likely not be approaching things in the best/most correct way. If you know of a better way to do something, or if I'm sharing incorrect info, please correct me!
Modern programming relies on a complex of interconnected tools to do anything mildly useful. Some things that work great with one version of a tool, just won't work in the next version. So, I can only promise that this works with the exact setup I'm running, and if you find a workaround due to a difference in your setup, please post it.
If you restart Cinema 4D at this point, you may be disappointed to discover that no new plugins have shown up. That's because we need to...
In previous versions of C4D you would have to have a keen understanding of Visual Studio to setup a project from scratch, or the patience to duplicate an existing working project and then rip out everything that doesn't do what you need. Maxon has provided a really great new tool that allows you to build a working Visual Studio project file from a single source directory so long as it includes a specifically named and formatted .txt file.
You've now created a Visual Studio project file that could be used to compile your project. But there's still more we have to do.
VC++ 2015.3 v14.00 (v140) toolset for desktop
Congratulations! You've successfully compiled the Cinema 4D SDK Example Plugins!
Hello and thanks for your elaborate post.
I just want to add that - as you said - one should use Visual Studio 2015 for C++ plugin development. When you re-use the Project Tool it might overwrite your manually changed project files.
Also you can start Cinema 4D from within Visual Studio. You can also define the plugin path by settting the g_additionalModulePath command line argument.
You find information on this in the "Development for Microsoft Windows" manual.
You probably want to add that all projects (including frameworks) have to be set to use C++17 language when using 2017 with platform toolset 141, otherwise there will be compiler errors.
So, no need to install the older platform toolset.
thank you for this it really helped me to get things going again
Thank you for the guide. But is there a way to proceed without downloading 5GB? or is there a way to download the 5GB installer so I can reuse it again.
I'm using R21.
Hi @bentraje, I'm not sure of which 5Gb you are talking about, the cinema SDK is only few mb so I guess you are speaking about Visual Studio. If that the case yes you need visual studio with the C++ component to compile.
Thanks. You are right. It didn't exceed 5GB. I guess 5GB is when it is uncompressed.
I was able to build the plug-ins now.