I've been trying all day to find a way to use the libharu library on windows with c++, but I can't figure out how to build it...
I've tried nmake -f script/Makefile.msvc
but this gives me:
Microsoft (R) Program Maintenance Utility Version 14.31.31107.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl -Fosrc\hpdf_utils.obj -MT -nologo -O2 -Iinclude -Iwin32\include -I"../../libpng"\include -I"../../zlib"\include -c src\hpdf_utils.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.
I also tried using vcpkg but I get an error saying it cannot find visual studio. I put a VCPKG_VISUAL_STUDIO_PATH
variable pointing to C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE
and it still can't find a valid visual studio instance.
Since my c++ project is compiled with mingw I tried using mysys and ran the buildconf.sh
file to make a configure file which I then ran with ./configure
within mysys and I get
checking Zlib install prefix... configure: error: Unable to locate Zlib headers, please use --with-zlib=<DIR>
I'm kind of tired of working on this thing and I need to be able to use this library. I don't really know how I can install zlib on mysys or whatever this problem is. I know on Linux it would be easier but I need to compile this for windows. Did anyone ever successfully build libharu on windows and if yes how did you do it?
Looking forward to any help I can get.
nmake uses a different syntax than the Unix makefiles; try to compile it with Visual Studio and cmake to generate the solution.
In addition, run it in Visual Studio's command prompt (
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
)I was able to compile libharu without errors with theese commands (in the directory of the repo):
After that, I found the build in the folder, ".\out\src\Debug".