> On 7 Jan 2017, at 05:26, Alexander Ivanenko wrote:
>
> I used the existing projects for VS 2010(I added x64 configuration there).
> However, Greg could be right - WIN32 should be defined even for x64. The thing is that I added FLTK example code to one of my older projects and it could be that WIN32 definition was manually removed from the building configuration there.
Note, as Greg pointed out, that “WIN32” is something of a misnomer these days, in that the “32” bit doesn’t mean that it only applies to 32-bit systems. The “WIN64” setting is like an extension to that, but in effect *both* are needed, not one or the other.
Though, I don’t think fltk uses WIN64 at all - all the API’s we use are portable, so in fact fltk probably only needs WIN32 set, on either 32 or 64-bit Windows hosts.
It might be worth noting that the executable format that MS use on their 64-bit systems is similarly confusingly named.
32-bit Windows executables are typed as “PE32”, whereas 64-bit Windows executables are typed as “PE32+” (i.e. 32-bit with extensions, I suppose, rather than PE64, say.)
I have no idea why they chose to go that way, but it always struck me as odd.
Likely something to do with backwards compatibility at a guess, but who knows?
On a more pertinent note; older MS compilers used to define WIN32 as well as _WIN32 and so forth, and fltk *depends* on finding WIN32 set. However, more recent MS compiler no longer set WIN32, whilst they do still set _WIN32.
The fltk build files dodge that issue by ensuring that WIN32 is also set, but other projects that depend only on the compiler setting the definitions might be caught out.
That is, code that used to work with an older MS compiler, and where WIN32 was set, may now appear broken because the compiler has stopped setting WIN32 and now just sets _WIN32 instead.
Summary: make sure WIN32 is set in your build config, and all should be well!