UNSOLVED Linker error in new plugin project: DllMain already defined?

Hi,

I started a vey small new R25 plugin project, and I constantly get linker errors. The project was, of course, generated using the S24 Project Tool.

cinema.framework_Debug_64bit.lib(c4d_pmain.obj) : error LNK2005: DllMain already defined in MSVCRTD.lib(dll_dllmain_stub.obj)
Creating library C:\Program Files\MAXON\Cinema 4D R25\plugins\testplugin\project_obj\testplugin\x64_Debug\testplugin.xdl64.lib and object C:\Program Files\MAXON\Cinema 4D R25\plugins\testplugin\project_obj\testplugin\x64_Debug\testplugin.xdl64.exp
..\testplugin.xdl64 : fatal error LNK1169: one or more multiply defined symbols found

Is there a commonly known reason why this could happen?

I already compared the .vcxproj file to the ones from my projects that are building fine, and couldn't find any significant difference. I even copied over the project file from cinema4dsdk, and simply swapped out the source files, it didn't help.

The funny thing is that the new plugin consists only of source files that I took from another plugin, to move them into a separate plugin project. So the sources definitely can be compiled and work. No problem in their original plugin project. Therefore, I deduct that there must be something wrong with the new plugin project.

Cheers in advance,
Frank

Hi,

Did you tried to generate the project files with the latest Project Tools?
Check if you did not add some dependencies "by hand" on the project that works.

As always, it's hard to answer such a question with nothing to test.

Cheers,
Manuel

I found it!

In deed, I added two frameworks to the solution by hand. I also added the project references in my plugin project.

Creating a project reference manually in VS results in this block in the .vcxproj file:

    <ProjectReference Include="..\..\..\frameworks\cinema.framework\project\cinema.framework.vcxproj">
      <Project>{69bf9b7d-7eb2-7fc5-0009-38cb8c5cdea3}</Project>
    </ProjectReference>

But that's not sufficient, it needs to looks like this:

    <ProjectReference Include="..\..\..\frameworks\cinema.framework\project\cinema.framework.vcxproj">
      <Project>{69bf9b7d-7eb2-7fc5-0009-38cb8c5cdea3}</Project>
      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
      <LinkLibraryDependencies>true</LinkLibraryDependencies>
      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
    </ProjectReference>

This fixed my build problems 👍

Did you tried to generate the project files with the latest Project Tools?

I used the S24 Project Tool, which is the recommended one for R25 plugins.

Cheers,
Frank

Ah, sorry, it still happens under certain circumstances. I had to set this topic back to "Unsolved".

If it helps, I have narrowed it down to specific code that has to be in a .cpp file, in order to provoke the problem.
I can send you a tiny project that demonstrates it. What's the eMail again?

Cheers,
Frank

sure, go ahead
[email protected]

Thanks, you just recieved it!