むむむ...!!
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
# 以下でパスを書き出してみたところ...
message(${PNG_LIBRARY}) # /usr/local/lib/libpng.dylib
message(${PNG_INCLUDE_DIR}) # /Library/Frameworks/Mono.framework/Headers/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include
ビルド時と実行時に使用されていたlibpng
のバージョンが違ったみたい
include_directories()
で指定するパスを相対パスで直書きに変更
# 今回ダメだった
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
target_link_libraries(RAY ${PNG_LIBRARY})
# 無事に実行できた
find_package(PNG REQUIRED)
include_directories("../Utils/libpng")
target_link_libraries(RAY ${PNG_LIBRARY})
png_malloc
それぞれ static_cast
で型を指定してあげたらコンパイルできた
// datap は png_bytepp
datap = static_cast<png_bytepp>(png_malloc(png, sizeof(png_bytep) * bitmapData->height));
datap[j] = static_cast<png_bytep>(png_malloc(png, bitmapData->width * bitmapData->ch));
https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Desktop-generic/LSB-Desktop-generic/libpng12.png.malloc.1.html
https://github.com/kugimasa/RAY/commit/6ff8194ad20f14e14157e5bd1e526e44979b367f