bugpng++, a C++ wrapper for libpng - Bugs: bug #39543, Missing string header included

 
 

bug #39543: Missing string header included

Submitter:  None
Submitted:  Sun 21 Jul 2013 01:39:04 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 25 Oct 2015 02:42:42 PM UTC, comment #1: 

Well, better later than never.

I don't know which version of png++ you were using, but this problem has been long fixed (for Win32, but that doesn't really matter):

r119 | alexshulgin | 2011-01-24 10:06:26 +0100 (Mo, 24 Jan 2011) | 1 line

Added #include <string> for error.hpp: fix compilation on Win32.

Verified that it works with current versions of g++ and clang++ just now.

Alexander Shulgin <alexshulgin>
Group administrator
Sun 21 Jul 2013 01:39:04 PM UTC, original submission:  

It looks like there should be included string header file in png++/png.hpp. In attached file image_wrapper.h when I comment out #include <string> I get following errors:


tomas789@Tomass-iMac:~/Developer/drawer/drawer$ clang++ -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix

tomas789@Tomass-iMac:~/Developer/drawer/drawer$ clang++ -std=c++11 -I /opt/local/include -lpng -L /opt/local/lib -stdlib=libc++ *.cpp
In file included from image_wrapper.cpp:9:
In file included from ./image_wrapper.h:19:
In file included from /opt/local/include/png++/png.hpp:38:
/opt/local/include/png++/error.hpp:77:43: error: invalid operands to binary expression ('const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') and 'const char *')
            : std::runtime_error((message + ": ") + strerror(error))
                                  ~~~~~~~ ^ ~~~~
In file included from image_wrapper.cpp:9:
In file included from ./image_wrapper.h:19:
In file included from /opt/local/include/png++/png.hpp:49:
/opt/local/include/png++/info.hpp:88:31: error: no matching conversion for functional-style cast from 'const char [22]' to 'png::error'
                        throw error("png_get_tRNS() failed");
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/png++/error.hpp:45:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char [22]' to 'const png::error' for 1st argument
    class error
          ^
/opt/local/include/png++/error.hpp:52:18: note: candidate constructor not viable: no known conversion from 'const char [22]' to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
        explicit error(std::string const& message)
                 ^
In file included from image_wrapper.cpp:9:
In file included from ./image_wrapper.h:19:
In file included from /opt/local/include/png++/png.hpp:51:
/opt/local/include/png++/io_base.hpp:463:21: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
        std::string m_error;
                    ^
/usr/bin/../lib/c++/v1/iosfwd:187:27: note: template is declared here
    class _LIBCPP_VISIBLE basic_string;
                          ^
In file included from image_wrapper.cpp:9:
In file included from ./image_wrapper.h:19:
In file included from /opt/local/include/png++/png.hpp:51:
/opt/local/include/png++/io_base.hpp:347:23: error: no matching conversion for functional-style cast from 'const char [43]' to 'png::error'
                throw error("set_shift: expected RGB or RGBA color type");
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/png++/error.hpp:45:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char [43]' to 'const png::error' for 1st argument
    class error
          ^
/opt/local/include/png++/error.hpp:52:18: note: candidate constructor not viable: no known conversion from 'const char [43]' to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
        explicit error(std::string const& message)
                 ^
In file included from image_wrapper.cpp:9:
In file included from ./image_wrapper.h:19:
In file included from /opt/local/include/png++/png.hpp:51:
/opt/local/include/png++/io_base.hpp:365:23: error: no matching conversion for functional-style cast from 'const char [50]' to 'png::error'
                throw error("set_shift: expected Gray or Gray+Alpha"
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/include/png++/error.hpp:45:11: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'const char [50]' to 'const png::error' for 1st argument
    class error
          ^
/opt/local/include/png++/error.hpp:52:18: note: candidate constructor not viable: no known conversion from 'const char [50]' to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
        explicit error(std::string const& message)
                 ^
5 errors generated.


With gcc version 4.9.0 20130630 (experimental) if everything ok.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28634:  image_wrapper.h added by None (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by alexshulgin (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-10-25 alexshulgin StatusNone Works For Me
        Open/ClosedOpen Closed
    2013-07-21 None Attached File- Added image_wrapper.h, #28634

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code