syoyo / tinydng

Header-only Tiny DNG/TIFF loader and writer in C++
MIT License
154 stars 30 forks source link

Add #ifndefs so compiles with TINY_DNG_LOADER_NO_STB_IMAGE_INCLUDE #45

Closed andrewwillmott closed 2 months ago

andrewwillmott commented 2 months ago

Small compile fix... needed TINY_DNG_LOADER_NO_STB_IMAGE_INCLUDE as I'm just using it as a tiff loader at the moment.

andrewwillmott commented 2 months ago

Just noticed my editor removed some trailing white space... lmk if you want it restored.

syoyo commented 2 months ago

Thanks! Confirmed the issue with

g++ -o test -DTINY_DNG_LOADER_NO_STB_IMAGE_INCLUDE -O0 -g -Wall -Werror test_loader.cc

In file included from test_loader.cc:8:
tiny_dng_loader.h: In function ‘bool tinydng::LoadDNGFromMemory(const char*, unsigned int, std::vector<tinydng::FieldInfo>&, std::vector<tinydng::DNGImage>*, std::string*, std::string*)’:
tiny_dng_loader.h:5752:23: error: ‘stbi_info_from_memory’ was not declared in this scope
 5752 |         int is_jpeg = stbi_info_from_memory(sr.data() + data_offset,
      |    
...

And the PR fixes it.