conan-io / conan-vs-extension

Conan Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=conan-io.conan-vs-extension
MIT License
59 stars 34 forks source link

[Bug] The linkage type generated during the dependencies compilation mismatches the project one #233

Closed Jeanmilost closed 2 weeks ago

Jeanmilost commented 3 weeks ago

In one of my Visual Studio project, I'm compiling a static DLL, as you can see on the below project option:

image

However, when Conan compile my dependencies, it generates this configuration file:

[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic    <== !!! This is not matching my project options !!!

compiler.runtime_type=Debug
compiler.version=193
os=Windows

As the Conan config file mismatches the one in my project option, I get this error during the linking time:

Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in MyRPCClient.obj MyShellExt C:\Projets\branches\vs2022_dev\MyShellExt\libboost_thread.lib(thread.obj) 1

On the other hand, if I manually correct my config file as below:

[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=static

compiler.runtime_type=Debug
compiler.version=193
os=Windows

the project compiles and links as expected.

Can you please fix that?

memsharded commented 3 weeks ago

Hi @Jeanmilost

Thanks for reporting.

I am submitting a potential fix in https://github.com/conan-io/conan-vs-extension/pull/235. It is the first time I contribute to the extension, I don't know enough about it, but looks doable.

Jeanmilost commented 3 weeks ago

@memsharded Thank you very much :-)

czoido commented 2 weeks ago

Hi @Jeanmilost we have just released 2.0.3 version of the plugin that should fix this, thanks a lot for reporting

czoido commented 2 weeks ago

@Jeanmilost we have detected some problems with 2.0.3 and had to revert, please do not update yet, we will fix this in 2.0.5

Jeanmilost commented 2 weeks ago

@czoido Ok, thank you for the notification.

czoido commented 2 weeks ago

@Jeanmilost finally these changes come in 2.0.5 that we have just released