Compile under 32bits but not under 64bits
Hello ¡¡¡ Probed with boost 1.38 and 1.40 on linux ubuntu karmic Example: check64.cpp --------------- #include "check64.hpp" int main() { point2<int> png_size1(3,4); point2<int> png_size2; wxMessageBox( wxT("Reading png dimensions prueba.png "), wxT("Hello") ); // ok, compile into 32bits and 64bits png_size2=png_size1; // ok, compile into 32bits and 64bits png_read_dimensions( "prueba.png" ); //ERROR, THIS ONLY COMPILE WITH 32bits png_size1 = png_read_dimensions( "prueba.png" ); return 0; } ---------------------------------------- The error when try to compile with 64bits is: error: no match for ‘operator=’ in ‘png_size1 = boost::gil::png_read_dimensions(const char*)()’ Anybody knows what is happening ? The head file, check64.hpp is -------------------------- check64.hpp ------------- #ifndef CHECK64_HPP_INCLUDED #define CHECK64_HPP_INCLUDED #include <boost/gil/gil_all.hpp> #include <boost/gil/extension/io/png_io.hpp> #include <wx/wx.h> using namespace boost; using namespace boost::gil; using namespace std; #endif // CHECK64_HPP_INCLUDED --------------------------end of code -------------- Thank's a lot of
Hi Juanma, On Thu, Mar 18, 2010 at 3:14 PM, Juanma Font <juanmafont@gmail.com> wrote:
Hello ¡¡¡
Probed with boost 1.38 and 1.40 on linux ubuntu karmic
Example: check64.cpp
--------------- #include "check64.hpp"
int main()
{ point2<int> png_size1(3,4); point2<int> png_size2;
wxMessageBox( wxT("Reading png dimensions prueba.png "), wxT("Hello") );
// ok, compile into 32bits and 64bits png_size2=png_size1;
// ok, compile into 32bits and 64bits png_read_dimensions( "prueba.png" );
//ERROR, THIS ONLY COMPILE WITH 32bits png_size1 = png_read_dimensions( "prueba.png" );
return 0; }
Can you use ptrdiff_t instead of int? If not you might have to define a custom convert function since png_read_dimensions() returns point2<ptrdiff_t>. A fix is simple but you might be satisfied with ptrdiff_t. Regards, Christian
Hello, Christian ¡¡¡¡¡¡¡ Yes ¡¡¡¡ Firts trying a casting onto function -------------- png_size1 = (ptrdiff_t) png_read_dimensions( "prueba.png" ); -------------- This give a error, but important information-> error: invalid cast from type ‘boost::gil::point2<long int>’ to type ‘ptrdiff_t’ So try: ---- point2<long int> png_size1(3,4); ---- And all is it OK :)))) But your solution is the best. ---------- point2<ptrdiff_t> png_size1(3,4); ..... png_size1 = (ptrdiff_t) png_read_dimensions( "prueba.png" ); --------- And leave the compiler to choose the correct type ¡¡¡¡ ;) Thank a lot of.. 2010/3/19, Christian Henning <chhenning@gmail.com>:
Hi Juanma,
On Thu, Mar 18, 2010 at 3:14 PM, Juanma Font <juanmafont@gmail.com> wrote:
Hello ¡¡¡
Probed with boost 1.38 and 1.40 on linux ubuntu karmic
Example: check64.cpp
--------------- #include "check64.hpp"
int main()
{ point2<int> png_size1(3,4); point2<int> png_size2;
wxMessageBox( wxT("Reading png dimensions prueba.png "), wxT("Hello") );
// ok, compile into 32bits and 64bits png_size2=png_size1;
// ok, compile into 32bits and 64bits png_read_dimensions( "prueba.png" );
//ERROR, THIS ONLY COMPILE WITH 32bits png_size1 = png_read_dimensions( "prueba.png" );
return 0; }
Can you use ptrdiff_t instead of int? If not you might have to define a custom convert function since png_read_dimensions() returns point2<ptrdiff_t>. A fix is simple but you might be satisfied with ptrdiff_t.
Regards, Christian _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christian Henning
-
Juanma Font