I have a Console Project LinkExample
that contains a main.cpp
.
#include <Library/Logger.hpp>
int main()
{
WriteSomething();
return 0;
}
The LinkExample
links a static Library Project named Library
. Library.Lib
is linked correctly.
Library contains a Logger.hpp
#pragma once
void WriteSomething();
Logger.cpp
#include <boost/log/trivial.hpp>
#include <Library/Logger.hpp>
void WriteSomething()
{
BOOST_LOG_TRIVIAL(trace) << "Trace";
}
The NuGet Packages are:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.63.0.0" targetFramework="native" />
<package id="boost_log-vc140" version="1.63.0.0" targetFramework="native" />
</packages>
LinkExample
does not build and shows the error LNK1104 for file libboost_log-vc140-mt-gd-1_63.lib
.
When linking statically I would want this library to be baked into Library
, why does this not happen and how can I fix that?
I am aware that I could add packages to LinkExample
but that is not a long term solution.
Adding packages until the solution runs would include these packages.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.63.0.0" targetFramework="native" />
<package id="boost_date_time-vc140" version="1.63.0.0" targetFramework="native" />
<package id="boost_filesystem-vc140" version="1.63.0.0" targetFramework="native" />
<package id="boost_log-vc140" version="1.63.0.0" targetFramework="native" />
<package id="boost_system-vc140" version="1.63.0.0" targetFramework="native" />
<package id="boost_thread-vc140" version="1.63.0.0" targetFramework="native" />
</packages>
In a larger Project things started falling apart with this approach after switching boost to dynamic linking.
How do I get rid of my root problem that the lib files are linked by my customer library?
Note that the "Link Library Dependencies" setting does nothing here, using this setting would require a project setup that is incompatible with NuGet.