Jenkisz
Jenkisz

Reputation: 1

libTIFF: TIFFOpen: test.tif: Cannot open

I tested libTIFF with the CLion builder. However, no matter what I did, it always said I can't open the tiff image... I guess maybe something broken in the find_package(TIFF), so I download the tiff raw source and build it with cmake in the directory C:/Program Files/tiff but still not work. Here is my cmakelists

cmake_minimum_required(VERSION 3.28)
project(testTIFF)
set(CMAKE_CXX_STANDARD 17)

add_executable(testTIFF main.cpp)

set(TIFF_DIR C:/Program Files/tiff)
find_package(TIFF REQUIRED)
link_directories(${TIFF_LIBRARY_DIRS})
include_directories(${TIFF_INCLUDE_DIRS})
message(STATUS "TIFF_INCLUDE_DIRS:" ${TIFF_INCLUDE_DIRS})
message(STATUS "TIFF_LIBRARIES:" ${TIFF_LIBRARIES})

target_link_libraries(testTIFF ${TIFF_LIBRARIES})

Here is the simple source code copied from the TIFF web.

#include <iostream>
#include "tiffio.h"
int main() {
    TIFF* tif = TIFFOpen("test.tif", "r");
    /* ... do stuff ... */
    TIFFClose(tif);
    return 0;
}

and return the null pointer with TIFFOpen... so: TIFFOpen: test.tif: Cannot open.

I just want to read the images, but it never works. I want to know what happened?

Upvotes: 0

Views: 105

Answers (0)

Related Questions