compiling for r20 new solution
-
Dear c4d fellows,
I have the following question.
I'm trying to compile my own (beginner) plugin (solution) in VS2019.
I have c4d r20.I created a projectdefinition.txt
Platform=Win64;OSX Type=Solution Solution=\ plugins/architect4D;\ APIS=\ cinema.framework; \ misc.framework; \ image.framework; \ core.framework C4D=true stylecheck.level=0 ModuleId=com.streamline.architect4D INCLUDE=source/architect4D.cpp; INCLUDE=source/architect4D.h;
Then I created minimal .cpp
#include "maxon/parallelfor.h" #include "c4d.h" #include "c4d_symbols.h" #include "architect4D.h" //#include "commandlinerender.cpp" class architect4D : public CommandData { public: virtual Bool Execute(BaseDocument* doc); }; Bool architect4D::Execute(BaseDocument* doc) { return true; } Bool Registerarchitect4D() { // be sure to use a unique ID obtained from www.plugincafe.com return RegisterCommandPlugin(1054040, GeLoadString(IDS_ARCHITECT4D), 0, AutoBitmap("architect4D.tif"_s), "arhitect4D Plugin"_s, NewObjClear(architect4D)); }
and .h
#ifndef ARCHITECT4D_H__ #define ARCHITECT4D_H__ #include "ge_prepass.h" #include "c4d_plugin.h" class BaseDocument; //class AtomArray; Bool Registerarchitect4D(); //void CommandLineRendering(C4DPL_CommandLineArgs* args); #endif // ARCHITECT4D_H__
and c4d_symbols.h
enum { // string table definitions IDS_ARCHITECT4D = 10000, _DUMMY_ELEMENT_ }; #pragma once
When compiling I have the following errors from Linker:
Error LNK2019 unresolved external symbol "bool __cdecl PluginStart(void)" (?PluginStart@@YA_NXZ) referenced in function c4d_main architect4d C:\sdk20\plugins\architect4d\project\cinema.framework_Debug_64bit.lib(c4d_pmain.obj) Error LNK2019 unresolved external symbol "void __cdecl PluginEnd(void)" (?PluginEnd@@YAXXZ) referenced in function c4d_main architect4d C:\sdk20\plugins\architect4d\project\cinema.framework_Debug_64bit.lib(c4d_pmain.obj) Error LNK2019 unresolved external symbol "bool __cdecl PluginMessage(int,void *)" (?PluginMessage@@YA_NHPEAX@Z) referenced in function c4d_main architect4d C:\sdk20\plugins\architect4d\project\cinema.framework_Debug_64bit.lib(c4d_pmain.obj)
What do I do wrong? It seems some linker settings are wrong. Could you please help me with this?
Yaroslav.
-
Hello,
the recommended VS version for Cinema 4D R20 is VS 2015, see https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_dev_windows.html.
Every plugin has to implement PluginStart(), PluginMessage(), and PluginEnd().
You find an example here: https://github.com/PluginCafe/cinema4d_cpp_sdk_extended/blob/master/plugins/microsdk/source/main.cpp
See also https://developers.maxon.net/docs/cpp/2023_2/page_manual_module_functions.html
-
Thanks, for your comment!
But:@PluginStudent said in compiling for r20 new solution:
Every plugin has to implement PluginStart(), PluginMessage(), and PluginEnd().
Well, is this really right?
I mean, look at sdk menutest example.
I simply copied it and changed the name.
But probably, you are right! -
Thank you so much! It worked!
Yaroslav.