Open pedro-vicente opened 3 years ago
I made a sample project that replicates the bug
https://github.com/pedro-vicente/xlnt_sample
it uses the STATIC settings with
git clone https://github.com/tfussell/xlnt xlnt-1.5.0
# clone missing dependency
pushd xlnt-1.5.0
pushd third-party
pushd libstudxml
git clone https://git.codesynthesis.com/libstudxml/libstudxml.git
popd
popd
popd
# build
mkdir -p build/xlnt-1.5.0
pushd build
#XLS
pushd xlnt-1.5.0
cmake ../../xlnt-1.5.0 -DSTATIC_CRT=ON -DSTATIC=ON
cmake --build .
popd
# example project
cmake .. -DBUILD_STATIC=ON
cmake --build . --parallel 9
popd
If your xlnt project ran well, then you got the file xlntd.lib & xlnt.lib, your project type should meet to them, such as x86 or x64, debug or release version.
In VS project, you could add it in stdafx.h like this: `
#pragma comment (lib, "xlntd.lib")
#pragma comment (lib, "xlnt.lib")
` mismatch project type would cause this error. xlntd.dll and xlnt.dll were necessary for your project.
when using the library with the static settings on a project
cmake ../../xlnt-1.5.0 -DSTATIC_CRT=ON -DSTATIC=ON
I have link errors
that happen because for some reason the symbol XLNT_API is defined as __declspec(dllimport)
here
Note: this just hapens on my project, not on the XLNT project itself, that builds fine
I tried just to hard code define it as
define XLNT_API
but got other linking errors because of inconsistent CRT use I use Multi-threaded Debug (/MTd) on my project but the library was using /MDd
the only way to fix this was to use this call on the Cmake script
that forces Multi-threaded Debug (/MTd) (requires Cmake 3.17)
and still hard code this
#define XLNT_API