Converting plugins from C4D 2024 to 2025
In recent years this has been a sometimes painful process, so it was nice to see that although plugins built for Cinema 4D 2024 won't run on 2025, the conversion process is mostly easy and quick. Usually, adding the line:
using namespace cinema;
after the header file includes does all you need - for a couple of plugins, that was all I needed to do. There are one or two wrinkles though which I noticed when converting, and I thought I'd share them here.
1. main.cpp
Every project will have one of these. The Maxon example files (this snippet comes from main.cpp in example.main) say this:
//This is the main file of the Cinema 4D SDK
// An empty project simply looks like this:
#include "c4d.h"
Bool PluginStart()
{
// ...do or register something...
return true;
}
void PluginEnd()
{
}
Bool PluginMessage(Int32 id, void *data)
{
return false;
}
However, that won't build. It will compile without errors, but it won't link - we get linker errors for 'unresolved external symbol' for the three functions.
It's tempting to think that you can fix this by adding 'using namespace cinema' after the include file, but that won't work either. What you have to do is add the functions to the namespace like so:
//This is the main file of the Cinema 4D SDK
// An empty project simply looks like this:
#include "c4d.h"
namespace cinema // now the functions are added to the namespace
{
Bool PluginStart()
{
// ...do or register something...
return true;
}
void PluginEnd()
{
}
Bool PluginMessage(Int32 id, void *data)
{
return false;
}
}
Then it will link correctly.
2. extern variables in main.cpp
The other problem I encountered was in a plugin in which two extern variables were referenced in main.cpp like so:
#include "c4d.h"
extern BaseBitmap* g_MasterIcons;
extern BaseBitmap** iconArray;
namespace cinema
{
Bool PluginStart(void)
// etc.....
This won't link either if, as was the case with my plugin, the two variables are defined in a .cpp file which didn't use the cinema namespace (because it didn't need to). Simply moving those two 'extern' lines to within the cinema namespace won't work either, unlike the previous issue above. The solution for this is either to add the 'using namespace cinema' line to the file defining the variables, or if that is not possible for some reason, you can use the specific qualifier:
#include "c4d.h"
extern cinema::BaseBitmap* g_MasterIcons;
extern cinema::BaseBitmap** iconArray;
namespace cinema
{
Bool PluginStart(void)
// etc.....
Then it will link correctly.
Those are the only two issues I've encountered so far. If I find more, I'll add them here.
Page last updated September 16th 2024