Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Linker error in new plugin project: DllMain already defined?

    Cinema 4D SDK
    c++ classic api windows r25
    3
    7
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fwilleke80F
      fwilleke80
      last edited by fwilleke80

      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

      www.frankwilleke.de
      Only asking personal code questions here.

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        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

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • fwilleke80F
          fwilleke80
          last edited by fwilleke80

          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

          www.frankwilleke.de
          Only asking personal code questions here.

          1 Reply Last reply Reply Quote 0
          • fwilleke80F
            fwilleke80
            last edited by

            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

            www.frankwilleke.de
            Only asking personal code questions here.

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              sure, go ahead
              [email protected]

              MAXON SDK Specialist

              MAXON Registered Developer

              1 Reply Last reply Reply Quote 1
              • fwilleke80F
                fwilleke80
                last edited by

                Thanks, you just recieved it!

                www.frankwilleke.de
                Only asking personal code questions here.

                1 Reply Last reply Reply Quote 0
                • M
                  m_adam
                  last edited by

                  Hello @fwilleke80,

                  without further questions or postings, we will consider this topic as solved by Thursday 01/06/2023 and flag it accordingly.

                  Thank you for your understanding,
                  Maxime.

                  MAXON SDK Specialist

                  Development Blog, MAXON Registered Developer

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post