Another compiling help request/material baking

On 16/09/2015 at 17:01, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   16 
Platform:   Windows  ;   
Language(s) :     C++  ;


Hello all!

I heard someone say there aren't enough threads or pages on getting your first c++ project off the ground, so I thought I'd start another one 😐

//Material bake part
Before I do that--and mods lemme know if this should be split into two separate questions--I should state that my end goal is to bake an object's two materials into one texture sequence.  Both are camera projected onto the mesh (one doesn't have to be, one definitely has to be), and the one that has to be projected uses an image sequence in the luminance.  I know python can't do it, but I'm hoping c++ can in some way enable me to output a single texture sequence from these two different materials (as if you went frame-by-frame and hit bake object on each frame).  So if you happen to know that's not possible, stop me here 🙂

//c++, the real question part
That said, I'd like this to be a standalone c++ plugin so I can easily distribute it to colleagues.  I've researched it and found the common helps like microbion's and noske's, both among others mentioned here, and I ended up with similar trouble as RK here.  Whew!

Only when I tried to resolve the _api_Win32_Debug.lib by compiling the cinema4dsdk.vcxproj, I get an error stating "The build tools for v140 cannot be found..."  Gaahh!  Does this have to do with the fact I was using VS 2015 before switching to 2012 for this project?  It suggests I should "Update VC++ Projects... to build using the v140 build tools," but I don't think I want to do that and, even if I did, the options to do so aren't listed where it says they should be.  Googling it hasn't come up with anything/anything I can understand.  Does this even make sense? xD**

I've been trying again from scratch for a couple days, now--please forgive me if the answer's obvious, it's a lot to take in.

Ok, if you read all that: god(s) bless you, and thanks for any help in advance.  Lemme know if I should clarify anything.

On 17/09/2015 at 02:05, xxxxxxxx wrote:


for the C++ question. This is indeed related to VS2015. In project settings go to Configuration Properties -> General. There you can configure the Platform Toolset. For R16 this should be "Visual Studio 2012 (v110)". For R17 use "Visual Studio 2013 (v120)".

For the baking question, maybe you can use BakeTexture() for this. Baking each texture tag and afterwards combining the images.

On 17/09/2015 at 12:22, xxxxxxxx wrote:

Riiiight, gotchya, thanks so much, Andreas!

Ermm, would you mind clarifying for me how the _api_Win32_Debug.lib is created by building the various targets?  It doesn't for me; I assume I have some output field not set...  And if I can't figure it out after that I'll give up and quit bothering everyone xD

On 21/09/2015 at 13:02, xxxxxxxx wrote:

Welp, still haven't produced the _api_Win32_Debug.lib (or any of them).  Is there a place I can download a fresh cinema4dsdk example for r16, just in case I accidentally buggered the copy I made mucking about in the properties?

::sigh:: This is confusing for a python guy.

On 02/10/2015 at 12:12, xxxxxxxx wrote:

Ok, I'm getting there!  Still working on this 🙂

Is it possible to guess what I'm missing when I get a bunch of unresolved externals that look like:

error LNK2019: unresolved external symbol "void __cdecl FreeGLTestObject(void)" ([email protected]@YAXXZ) referenced in function "void __cdecl PluginEnd(void)" ([email protected]@YAXXZ) where the file value is \main.obj?

Thanks guys, I appreciate any little helpful nudges...

In this case, I was following Maxon's how-to here, just in case that's helpful.  I realize unresolved links might be undiagnosable without looking at the whole deal 😕

On 07/10/2015 at 04:48, xxxxxxxx wrote:

Hi Whithers,

I'm terribly sorry you had to wait so long for me returning to your thread.
Regarding the _api_Win32_Debug.lib questions: Are you still trying to do 32-Bit builds? Which C4D version are you using for this? And do you really have users still working with 32-Bit systems?

Now, for the linker error:
In your plugin's main.cpp in the function PluginEnd() you seem to be calling FreeGLTestObject(). And the linker can not find the object file or the library containing this function. This can have several reasons. For example library search path might not be set up correctly. Or maybe you fail to link against the library (DLL) containing this function.

On 08/10/2015 at 15:03, xxxxxxxx wrote:

Not at all!  These are such dumb questions I really appreciate anyone taking the time, and I have plenty of other work to do parallel to solving this.

1: No, I'm fairly certain no-one would need a 32 bit version; I mentioned the _api_Win32_Debug.lib just because it was the first I was trying to get to work.  Embarrassingly, I'm not even sure I need any of those .lib files because the references to them are from sources dealing with earlier versions of c4d--I'm using R16 and (now) VS 2012--and it's not mentioned on the r16-specific page I linked to in my last post (which somehow took me a while to find).  I'm new enough to this process that I'm spending a lot of time learning VS/c++ fundamentals; coding the actual script is going to be so much easier!

2: Ok, I found one thing that was missing in my Include directories that solved most of the errors (forgot to add it to Release x64's properties), but I'm still left with this dang unresolved external symbol error griping about PluginStart(), PluginEnd() and PluginMessage().  Seems they're mentioned in the c4d_plugin.h header, which is where you'd expect in the framework's source folder, and I've quintuple-checked my Additional Includes, there's just something probably pretty basic I'm not getting. ::head-smack::

Here's the full error just in case it helps:

Error 1 error LNK2001: unresolved external symbol "void __cdecl PluginEnd(void)" ([email protected]@YAXXZ)      c4d_pmain.obj(<--File) cinema.framework(<--Project)

Any clue what I'm missing?  Thanks again!

On 12/10/2015 at 09:30, xxxxxxxx wrote:

Oh.  My.  Goodness.  I did it.  I don't even know how, I just tried again from scratch for the Nth time and it worked.  For people googling this later, I'm sorry this thread isn't much help--just keep running into the wall until you chip it away brick at a time!

Thanks for the help and moral support, Andreas!

On 12/10/2015 at 09:32, xxxxxxxx wrote:

I haven't done much! Actually I'm terribly sorry I haven't had the time to help you more. 😊
Glad that you did it anyway! 👏

On 12/10/2015 at 12:31, xxxxxxxx wrote:

No worries!

Ummm :cough: I did maybe possible speak a little too soon--knew it was too good to be true!  I still get the unresolved external symbols on PluginStart(void), PluginEnd(void), and PluginMessage(void) when trying to compile specifically the *realease* *x64* version of cinema.framework.  Looks just like what I posted above.

waarruummm 😢

On 12/10/2015 at 13:16, xxxxxxxx wrote:

Nevermiiiiiiinnndd woohoooooo  I just had to change it (cinema.framework) to Intel x64 instead of Release x64.

I'm so happy xD