Solved unresolved external symbol "void __cdecl maxon::_ConsoleOutputC4D when compiling under R19.

We developed a new plugin for R20, but we still have users on R19.
So, we need to compile the plugin also for R19.
Compiling is ok, but when linking I get the following error:

Severity	Code	Description	Project	File	Line	Suppression State
Error	LNK2001	unresolved external symbol "void __cdecl maxon::_ConsoleOutputC4D(enum maxon::OUTPUT,class String const &,__int64,char const *)" (?_ConsoleOutputC4D@maxon@@YAXW4OUTPUT@1@AEBVString@@_JPEBD@Z)	commandlinerendering	C:\Program Files\Maxon\CINEMA 4D R19.024\plugins\CommandLineRendering\commandlinerender.obj	1	

1ee47661-e061-4155-a494-99692de7dd03-image.png

What am I missing?

Hi @pim , thanks for reaching out us.

Looking at the error it looks like at the link time the linker is missing the Cinema 4D static libs.
With regard to your question do you confirm that:

  • you're using different IDE project files for R19 and R20?
  • you've just ported the code from R20 to R19 and not copied-pasted project related settings?
  • you're able to compile the cinema4dsdk on R19 without any problem?

Looking forward your answers, give best.

R

  • you're using different IDE project files for R19 and R20?

  • you've just ported the code from R20 to R19 and not copied-pasted project related settings?
    I took an old R19 project and started from there.
    I just copied the sources from R20 to the R19 project.

  • you're able to compile the cinema4dsdk on R19 without any problem?
    No issues when compiling.

Here the Solution Explorer.
de8315a2-151b-4232-be1a-383d21b8ffea-image.png

Projectsettings.prop

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="UserMacros">
    <MAXON_ROOTDIR>..\..</MAXON_ROOTDIR>
  </PropertyGroup>
  <PropertyGroup>
    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="MAXON_ROOTDIR">
      <Value>$(MAXON_ROOTDIR)</Value>
    </BuildMacro>
  </ItemGroup>
</Project>

Where can I check the Cinema 4D static libs?

Now the plugin is working in R20 and in R21, any suggestions for R19?

After some extra tests I found out that when I comment out all DiagnosticOutput()

// DiagnosticOutput("Rendering Phase: Finalize");

it compiles and links ok!

What could be wrong?

Pinned it down to

DiagnosticOutput(String());

Use maxon::String

And here another one

DiagnosticOutput("Loading Project: " + fn.GetString());

So I should use

DiagnosticOutput(maxon::String());?

And what to use for this one?

DiagnosticOutput("Loading Project: " + fn.GetString());

DiagnosticOutput() statements like these

DiagnosticOutput("Rendering successful: " + maxon::String::FloatToString((GeGetTimer() - starttime) / 1000.0) + " sec.");

give me the following warning:

c20f6f21-40cc-489c-99fe-de3565c3e1f5-image.png

Normal DiagnosticOutput() are ok

DiagnosticOutput("Rendering successful: ");

This is part of the R15 transition Change in R15, more information on
Debugging - Conversion To String
and String - Creation Manual.

And you are looking for maxon::FormatString

Cheers,
Maxime

Ok, I will read and try to understand.

Pim

Yes, I should have read the manual.
In R19 it is GeConsoleOut() and not DiagnosticOutput()

@pim
I have the original R16 and R19 SDK documentation installed locally, and there I do find DiagnosticOutput.
As such, I am still wondering what the issue is you have.

here's an excerpt from the R16 SDK documentation:

#define DiagnosticOutput 	( 	  	fmt,
		  	... 
	) 		

DiagnosticOutput outputs text into the console. The output is visible in debug builds or in a release build when the debug console with diagnostic output is activated. The full printf syntax can be used for the format string. THREADSAFE.

To me this seems mostly identical to what the current R21 online documentation mentions.
So in theory it should be no problem for R19.

Yes, strange.
But going from DiagnosticOutput() to GeConsoleOut() solved the issue.
Using maxon::String in DiagnosticOutput() seems to be the issue.

Looking at the doc in R19:

5fdf5fb0-1327-4589-b6b6-d68af8869c11-image.png
821d97fa-e103-4cca-84b1-85f0f50304f0-image.png

So I'm afraid there is no simple solution that will work on each version maxon::String being introduced in R20, you will need to adapt your code.

Cheers,
Maxime.