Search code examples
c++builderlibtiff

How to compile libtiff in C++ Builder?


I want to use libtiff in C++ Builder. I need to compile it, because distributed Windows binaries don't work with C++ Builder. How do I compile libtiff?


Solution

  • Libtiff version 4.5.1 supports CMake, but I faced some compile errors with C++ Builder 10.3.3. Therefore I created a project file manually.

    First, create some header files with CMake: Follow the documentation on how to use CMake with C++ Builder.

    Run command cmake -DCMAKE_C_COMPILER=bcc32c.exe -DCMAKE_CXX_COMPILER=bcc32c.exe -G Ninja . This generates following files: libtiff\tif_config.h, libtiff\tiffconf.h, and port\libport_config.h. You could also create them manually.

    Compiling the project:

    1. Create new project with type "Static library", and name it "libtiff"
    2. Add all C files from libtiff and port directories to the project, except tif_unix.c and mkspans.c
    3. Compile

    Files you need for your project:

    • libtiff.lib
    • All header files from libtiff directory