> I am trying to compile fltk-1.1.10 on windows 7 64bit with 
> gcc-4.5.1 from
> mingw64. It gives me the following error:


Hmm, I don't have a Win7 system (or, now that I think of it, any 64-bit Windows 
version anymore...) so I'll be guessing for a lot of this, but hey! - that 
never stopped me in the past so here goes...


> === making src ===
> Compiling Fl.cxx...
> In file included from ../FL/Fl_Group.H:32:0,
>                  from ../FL/Fl_Window.H:31,
>                  from Fl.cxx:34:
> ../FL/Fl_Widget.H: In member function 'long int 
> Fl_Widget::argument() const':
> ../FL/Fl_Widget.H:158:39: error: cast from 'void*' to 'long 
> int' loses precision

Yup - here's what I think is happening here: (Sorry if I start to ramble...)

The 64-bit model used by "most" systems is the so-called LP64, where "long" and 
"pointer" are 64-bit types, but "int" is still 32-bit.

For reasons I was never quite able to fathom, MS decided to go with a LLP64 
model, where "long long" and "pointer" are 64-bit, bit "int" *and* "long" are 
still 32-bit.
I guess this is an attempt to "protect" old 32-bit code that probably assumes 
that sizeof(int) == sizeof(long).

Anyway, why does that matter here? Well, internally some of the methods of 
Fl_Widget store the user_data member either in a "void *" or in a "long" and 
here we made the assumption that these were "equivalent".

Which they are in a ILP32 system or an LP64 system. But not in a Windows LLP64 
system...

That said, I thought we had fixed this. I have a really strong déjà vu about 
looking at this before, now...

Does fltk-1.3 work for you? Maybe it is fixed there?

If you feel like trying a hack, you might be able to find the offending casts 
between "long" and "void *" and change the definition of the "long" variable to 
"long long" and see if that flies...

> I tried to use mingw-gcc with the option CC="gcc -m32" to 
> build a 32bit-binary,
> but it gave me the same error. 

Hmm, odd. I'd have thought that would work... Dunno...

> Using mingw32 with a gcc-3.4 compiler (on WIndows
> XP SP3 32bit) worked fine, but I would like to build a 64bit version.
>  
> Has anybody come across this issue or does anybody have an 
> idea how to fix it?

See notes above - and let us know if 1.3 works for you.

The problem is that the 1.1 series is frozen now, so we are unlikely to do any 
fixes in that branch.


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to