cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

Linker failure VS 2017 #13

Closed GatorScott closed 7 years ago

GatorScott commented 7 years ago

I'm trying to use this library in VS 2017 and am getting the following linker error in a very plain Win32 application. Are there any solution or project settings I'm missing?

auto dom = svgdom::load(papki::FSFile("C:\Users\scott\Documents\TEMP\airport-15.svg")); unsigned width = 0; // 0 - Use width from SVG document unsigned height = 0; // 0 - Use height from SVG document auto img = svgren::render(*dom, width, height); // 96 dpi by default // img is a std::vector<std::uint32_t> holding array of RGBA values.

Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: bool _thiscall pugi::xmlattribute::empty(void)const " (?empty@xmlattribute@pugi@@QBENXZ) referenced in function "public: class std::uniqueptr<struct svgdom::Element,struct std::defaultdelete > _thiscall `anonymous namespace'::Parser::parseNode(class pugi::xmlnode const &)" (?parseNode@Parser@?A0x031f2505@@QAE?AV?$uniqueptr@UElement@svgdom@@U?$defaultdelete@UElement@svgdom@@@std@@@std@@ABVxml_node@pugi@@@Z) SvgRender C:\Users\scott\documents\visual studio 2017\Projects\SvgRender\SvgRender\libsvgdom.lib(dom.obj)

Version of related project downloaded from NuGet: cairo_static v1.15.4.1 libpapki v1.0.39 libpng v1.6.28.1 libpng.redist v1.6.28.1 libsvgdom v0.2.32 libsvgren v0.4.12 libutki v1.1.7 pixman_static v0.32.4.4 pugixml v1.8.0 zlib v1.2.8.8 zlib.v120.windesktop.msvcstl.dyn.rt-dyn v1.2.8.8 zlib.v140.windesktop.msvcstl.dyn.rt-dyn v1.2.8.8

igagis commented 7 years ago

Thanks for reporting this!

I found that this error occurs when trying to use the library in a project which is built using tools v141 (as in VS2017) while the library binaries are built with tools v140. I will need to fix it in the nuget package to include v141 binaries as well.

But for now, as a workaround you can set your project to use tools v140: Right click on your C++ project under solution -> Properties -> General -> Platform Toolset -> change to "Visual Studio 2015 (v140)". Let me know if it helped.

GatorScott commented 7 years ago

That fixed it. Thanks.

igagis commented 7 years ago

Fixed. Nuget package libsvgren version 0.4.13 contains v141 binaries.