Quantcast
Channel: MSBuild forum
Viewing all articles
Browse latest Browse all 2763

VS2015 C++ Multiply defined symbols only when exporting to a dll

$
0
0

Hi everyone,

I'm using Microsoft Visual Studio 2015 Community Edition (C++ code). I have a relatively simple, class template (fully generic, all methods defined inside class declaration, no type specializations) used by multiple projects.

One of my projects compiles only if that project is set to export to a static library. If I make it a dynamic library, the linker complains that the instantiation of the constructor of the aforementioned class template is multiply defined in two .obj files.

Note: the two .obj files contain the method definitions of two classes, one of which is derived from the other (i.e. base.obj and dervied.obj.)

I have tried inlining the constructor but it didn't help. Also, forcing output generates an invalid dll file.

Is this a bug? Is there a setting that I could use to get around this?


Viewing all articles
Browse latest Browse all 2763

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>