Compiling the R23 SDK examples

Note: written for R23 and later versions of Cinema 4D. Parts may also be applicable for R20 through S22.

The process is detailed quite well in the SDK documentation but isn't as clear as it could be. Hopefully this will give you a simple procedure to follow.

1. Install the SDK

In the Cinema 4D program folder you will find a file called 'sdk.zip'. This is the SDK itself plus the examples, so you need to unzip this file in a location of your choice. It must be a writeable location, so not in the Program Files hierarchy. I created a folder called 'C4DR23' and after unzipping sdk.zip into that folder you will have a directory structure like this:

The 'frameworks' folder we can ignore. The plugins to be built go into the 'plugins' folder and the SDK examples are in the 'cinema4dsdk' folder, just as in previous versions of C4D.

2. The Project Tool

If you look in the cinema4dsdk folder, you'll see that it has three folders, two of which are the usual 'res' and 'source' folders, plus another named 'project'. This in turn just has a single text file called 'projectdefinition.txt', and the Visual Studio solution or project files file you'd normally expect to see are not there. This is because the project files have to be created for each project, and to do this, Maxon provide a piece of software they call the 'Project Tool'. This is not present in the SDK so you have to download it separately, which you do from the Maxon developers' site at https://developers.maxon.net/?page_id=1118. Make sure you get the correct project tool for the SDK version you're using, as the syntax or options may change between versions.

Unzip this file to wherever you like; for convenience I put it in the 'C4DR23' folder I created earlier, so now the structure looks like this:

To create the solution file, you need to run this project tool, which for Windows is named kernel_app_64bit.exe. Annoyingly, this is a command-line tool (in 2021? Really?) so you can't just double-click it - that won't work. To make it go, open a Windows command prompt, navigate to the folder where the project tool is located, and type something like this:

kernel_app_64bit.exe g_updateproject="d:\documents\c4d plugins\c4dr23"

Note the inverted commas around the file location, needed if there are spaces in the string, and note also that this is the folder where the entire SDK including frameworks and the plugin folder is located. It must be an absolute path, not a relative one. Your location will obviously be different. You'll see a fair bit of output to a text console, and now, if you look in the cinema4dsdk/project folder you see the Visual Studio and Xcode project files. (You will also see that the other two 'plugins' named maxonsdk.module and microsdk also have the required project files. Don't worry about these.)

The solution file is located elsewhere though. It's in the plugins/project folder and is simply called 'plugins.sln'. You'll then realise that every time you add a new plugin project, it goes into the same solution, rather than having a separate solution for each plugin.

3. Build the SDK examples

Now load the solution file plugins.sln from the plugins/project folder and build it. It's possible you'll hit a problem. At the time of writing (late June 2021) there was a known issue in building the R23 SDK with VS 2019 build 16.9. The SDK will fail to build with an obscure error about an undefined class. To fix this, follow the steps here:

https://plugincafe.maxon.net/topic/13249/building-r23-sdk-with-visual-studio-16-9?_=1624877383686

and then it should build. Hopefully, this will be fixed by the time you read this.

4. So...back to the Project Tool

At this point you may be wondering how the project tool knows what to build and where. For this it relies on a text file called projectdefinition.txt in the plugins/project folder. And yes, each plugin also needs a configuration file of its own and although the contents are quite different that file has the same name - projectdefinition.txt - as the overall config file for the project tool! This is just plain confusing. We'll look at these files in the next tutorial, which covers adding your own plugins.

5. And on macOS?

As always, things are a touch different when using Xcode. I've added a supplementary page for additional information about compiling on the Mac.

Back to main tutorials page

Page last updated June 29th 2021