Lots of "unresolved external symbol" errors
-
I'm finally starting to compile (or trying to) my plugins in VisualStudio, in Windows.
I started with the simplest one and I'm getting lots of errors when building it.
Errors like:Error LNK2001 unresolved external symbol "public: static struct maxon::StringInterface::MTable maxon::StringInterface::MTable::_instance" (?_instance@MTable@StringInterface@maxon@@2U123@A) cmyk C:\Program Files\MAXON\Cinema 4D R20\sdk\plugins\cmyk\project\main.obj 1
Error LNK2019 unresolved external symbol "void __cdecl GePrint(class maxon::String const &)" (?GePrint@@YAXAEBVString@maxon@@@Z) referenced in function "bool __cdecl PluginStart(void)" (?PluginStart@@YA_NXZ) cmyk C:\Program Files\MAXON\Cinema 4D R20\sdk\plugins\cmyk\project\main.obj 1
Error LNK2019 unresolved external symbol "class Filename const __cdecl GeGetPluginPath(void)" (?GeGetPluginPath@@YA?BVFilename@@XZ) referenced in function "bool __cdecl PluginStart(void)" (?PluginStart@@YA_NXZ) cmyk C:\Program Files\MAXON\Cinema 4D R20\sdk\plugins\cmyk\project\main.obj 1
Error LNK2001 unresolved external symbol "class GeResource g_resource" (?g_resource@@3VGeResource@@A) cmyk C:\Program Files\MAXON\Cinema 4D R20\sdk\plugins\cmyk\project\main.obj 1
The cinema4dsdk compiled just fine. What can be going wrong?
-
How does your projectdefinition.txt look like?
Also, which project did you open in VS? -
The project I opened is the one selected here:
And the content of my projectdefinition.txt is:
// Supported platforms - can be [Win64;OSX]
Platform=Win64;OSX// Type of project - can be [Lib;DLL;App]
Type=DLL// API dependencies
APIS=image.framework;cinema.framework;mesh_misc.framework;math.framework;crypt.framework;python.framework;core.framework;command.framework// C4D component
C4D=truestylecheck.level=3 // must be set after c4d=true
// Custom ID
ModuleId=com.ruimac.cmyk -
Hi rui_mac, thanks for reaching us.
With regard to your question, it should be noted that you can't compile the
.vcxproj
file directly but rather you have to create a.sln
file to be opened in VisualStudio as Solution and then "build" it.I recommend you to have a look to the SDK Structure and more specifically to custom solution at our documentation.
Best, Riccardo
-
You have to open the master solution file, by default located in
sdk\plugins\project
. The projectdefinition.txt in there also has to be setup to load your cmyk plugin. -
I was just using the files that were created by Project Tool, just like I did on Xcode.
I already had a look at the links you provided (I had already seen those, when creating Xcode stuff) but, how can I create a .sln file? -
I went to the Build menu and selected "Build Solution" and I still got the same errors.
-
Ok, just to let you all know that it is finally working
-
Hi,
we are glad @rui_mac you were able to solve your problem.
I'd just like to quickly recap to make this also clear for future readers.Visual Studio has two "concepts" two organize your development work.
- Projects, which is basically a set of files plus a bunch of configuration options and instructions for the tool chain (compiler, linker,...) to build a binary (in our case here always a plugin library).
- Solutions, which are collections of above projects plus some additional global configuration data and more important, information on dependencies of the contained projects.
Now, our project tool can and does create both projects (for your plugins and for our frameworks) and a solution containing all of the above (actual workflow described in our docs under the links provided by Riccardo earlier on in this thread). So when you open such a solution and build your plugin project, also the frameworks it's depending on should be built.So, this is the way to go (project tool -> solution and projects -> open solution in Visual Studio).
But if you instead open just one of the generated projects directly, Visual Studio will implicitly generate a solution for you, but it still lacks the framework projects and the build of the opened project will fail (error: unresolved symbols, i.e. function or class names normally provided by our frameworks and used in the plugins code can not be resolved).I hope this makes it a bit easier to understand.
Cheers,
Andreas