Generate a library (.lib) file

时间:2016-10-20 12:49:25

标签: c++ static-libraries .lib

  1. I want to build Libharu and generate a static library (.lib) file. I am using VS2010.
  2. I want to build Libharu with ZLIB and Libpng support. I have already installed them and zlib.lib and libpng.lib are present in Program Files (x86)/GnuWin32/lib
  3. I followed the installation method for Windows platforms (except cygwin/MinGW) as mentioned on this official link
    • I used nmake -f script/Makefile.msvc which generated .obj files
    • then to check the success, I ran nmake -f script/Makefile.msvc demo, which successfully created the demo Pdfs

Question: How do I generate .lib file with zlib.lib and libpng.lib support?

PS: 1. Link for ZLIB installation

  1. Link for Libpng installation

UPDATE: By doing the above mention steps, i get the following output on console

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        if exist *.lib del *.lib
        lib -out:libhpdf.lib src\hpdf_utils.obj  src\hpdf_error.obj  src\hpdf_mmgr.obj  src\hpdf_list.obj  src\hpdf_streams.obj  src\hpdf_objects.obj  src\hpdf_null.obj  src\hpdf_boolean.obj
  src\hpdf_number.obj  src\hpdf_real.obj  src\hpdf_name.obj  src\hpdf_array.obj  src\hpdf_dict.obj  src\hpdf_xref.obj  src\hpdf_encoder.obj  src\hpdf_string.obj  src\hpdf_binary.obj  src\hpd
f_encrypt.obj  src\hpdf_encryptdict.obj  src\hpdf_fontdef.obj  src\hpdf_fontdef_tt.obj  src\hpdf_fontdef_type1.obj  src\hpdf_fontdef_base14.obj  src\hpdf_fontdef_cid.obj  src\hpdf_font.obj
src\hpdf_font_type1.obj  src\hpdf_font_tt.obj  src\hpdf_font_cid.obj  src\hpdf_doc.obj  src\hpdf_info.obj  src\hpdf_catalog.obj  src\hpdf_page_label.obj src\hpdf_gstate.obj  src\hpdf_pages.o
bj  src\hpdf_page_operator.obj  src\hpdf_destination.obj  src\hpdf_annotation.obj  src\hpdf_outline.obj  src\hpdf_image.obj  src\hpdf_encoder_jp.obj  src\hpdf_encoder_kr.obj  src\hpdf_encode
r_cns.obj  src\hpdf_encoder_cnt.obj  src\hpdf_fontdef_jp.obj  src\hpdf_fontdef_kr.obj  src\hpdf_fontdef_cns.obj  src\hpdf_fontdef_cnt.obj  src\hpdf_image_png.obj  src\hpdf_image_ccitt.obj  s
rc\hpdf_doc_png.obj  src\hpdf_ext_gstate.obj  src\hpdf_namedict.obj  src\hpdf_3dmeasure.obj  src\hpdf_exdata.obj  src\hpdf_u3d.obj
Microsoft (R) Library Manager Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

1 个答案:

答案 0 :(得分:1)

You need to set the environment variables ZLIB_PREFIX and PNG_PREFIX to the according folders they are installed in before you run the makefile

The scripts expects the folder PNG_PREFIX\include and PNG_PREFIX\lib to be existent (so set the variables to the folder both these folders are in).

The same goes for ZLIB_PREFIX.