atheros / xbrzscale

Image upscaling commandline tool using xBRZ algorithm
GNU General Public License v3.0
99 stars 17 forks source link

error: use of undeclared identifier 'Z_BEST_COMPRESSION' #4

Closed elmimmo closed 8 years ago

elmimmo commented 8 years ago

When trying to compile on OS X I get

g++ -std=c++0x -c -o xbrzscale.o xbrzscale.cpp `sdl-config --cflags`
g++ -c -o SDL_imagesave/IMG_savepng.o SDL_imagesave/IMG_savepng.c `sdl-config --cflags` -ISDL_imagesave
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
SDL_imagesave/IMG_savepng.c:293:22: error: use of undeclared identifier 'Z_BEST_COMPRESSION'
    if(compression > Z_BEST_COMPRESSION) compression = Z_BEST_COMPRESSION;
                     ^
SDL_imagesave/IMG_savepng.c:293:56: error: use of undeclared identifier 'Z_BEST_COMPRESSION'
    if(compression > Z_BEST_COMPRESSION) compression = Z_BEST_COMPRESSION;
                                                       ^
SDL_imagesave/IMG_savepng.c:350:23: error: use of undeclared identifier 'Z_NO_COMPRESSION'
    if(compression == Z_NO_COMPRESSION) {
                      ^
SDL_imagesave/IMG_savepng.c:352:44: error: use of undeclared identifier 'Z_NO_COMPRESSION'
        png_set_compression_level(png_ptr, Z_NO_COMPRESSION);
                                           ^
4 errors generated.
make: *** [SDL_imagesave/IMG_savepng.o] Error 1
atheros commented 8 years ago

Hi, I don't have OS X to test it. Can you try to add #include <zlib.h> in SDL_imagesave/IMG_savepng.c on line 44 and see if it solves the issue?

elmimmo commented 8 years ago

It solves that one, but others appear:

g++ -std=c++0x -c -o xbrzscale.o xbrzscale.cpp `sdl-config --cflags`
g++ -c -o SDL_imagesave/IMG_savepng.o SDL_imagesave/IMG_savepng.c `sdl-config --cflags` -ISDL_imagesave
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
g++ -std=c++0x -c -o xbrz/xbrz.o xbrz/xbrz.cpp -DNDEBUG
xbrz/xbrz.cpp:215:28: error: no member named 'pow' in namespace 'std'
    r = r > 0.04045 ? std::pow(( r + 0.055 ) / 1.055, 2.4) : r / 12.92;
                      ~~~~~^
xbrz/xbrz.cpp:216:28: error: no member named 'pow' in namespace 'std'
    r = g > 0.04045 ? std::pow(( g + 0.055 ) / 1.055, 2.4) : g / 12.92;
                      ~~~~~^
xbrz/xbrz.cpp:217:28: error: no member named 'pow' in namespace 'std'
    r = b > 0.04045 ? std::pow(( b + 0.055 ) / 1.055, 2.4) : b / 12.92;
                      ~~~~~^
xbrz/xbrz.cpp:234:37: error: no member named 'pow' in namespace 'std'
    var_X = var_X > 0.008856 ? std::pow(var_X, 1.0 / 3) : 7.787 * var_X ...
                               ~~~~~^
xbrz/xbrz.cpp:235:37: error: no member named 'pow' in namespace 'std'
    var_Y = var_Y > 0.008856 ? std::pow(var_Y, 1.0 / 3) : 7.787 * var_Y ...
                               ~~~~~^
xbrz/xbrz.cpp:236:37: error: no member named 'pow' in namespace 'std'
    var_Z = var_Z > 0.008856 ? std::pow(var_Z, 1.0 / 3) : 7.787 * var_Z ...
                               ~~~~~^
xbrz/xbrz.cpp:261:12: error: no member named 'sqrt' in namespace 'std'; did you
      mean 'sbrk'?
    return std::sqrt(square(1.0 * L1 - L2) +
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:357:12: error: no member named 'sqrt' in namespace 'std'; did you
      mean 'sbrk'?
    return std::sqrt(square(r_diff) + square(g_diff) + square(b_diff));
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:370:12: error: no member named 'sqrt' in namespace 'std'; did you
      mean 'sbrk'?
    return std::sqrt((2 + r_avg / 255) * square(r_diff) + 4 * square(g_d...
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:395:12: error: no member named 'sqrt' in namespace 'std'; did you
      mean 'sbrk'?
    return std::sqrt(square(lumaWeight * y) + square(c_b) +  square(c_r));
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:430:12: error: no member named 'sqrt' in namespace 'std'; did you
      mean 'sbrk'?
    return std::sqrt(square(luminanceWeight * y) + square(u) +  square(v));
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
11 errors generated.
make: *** [xbrz/xbrz.o] Error 1
atheros commented 8 years ago

This is fixed now, however SDL2 is now used. If you need SDL1.2 support, check sdl1.2 branch.