On 08.02.2018 05:46 imranmoezkhan wrote:
> Hi Albrecht,
> Thanks for your reply. Is there a link to updated build instructions for
> fltk? The MSWindows readme in the fltk directory has quite similar
> instructions - which I've tried to follow exactly.
I don't think that we currently have better instructions. I started new
installation instructions some time ago but I was distracted. I'll see
if I find this and update the documentation.
The new graphical MinGW installer is much easier to use but you still
need to select the correct packages.
> I did another clean install of MinGW to the recommended path (C:\MinGW
> ...I've done a lot of scripting work on unix, so I know how touchy it is
> about spaces in paths :-), and installed MSys in a sub-directory of
> MinGW as the mingw graphical installer does (is this the recommended
> way?). I think gcc and g++ are working correctly, because compiling for
> the source jpeg, zlib, png files proceeds without any problem. Its just
> when fltk source starts, that I get the following error:
>
> Compiling pngerror.c...
> Compiling pngpread.c...
> Archiving ../lib/libfltk_png.a...
> === making src ===
> Compiling Fl.cxx...
> In file included from Fl.cxx:1909:0:
> Fl_win32.cxx: In function 'RECT
> border_width_title_bar_height(Fl_Window*, int&,
> int&, int&, float*)':
> Fl_win32.cxx:2712:97: error: 'S_OK' was not declared in this scope
> if ( DwmGetWindowAttribute(fl_xid(win),
> DWMWA_EXTENDED_FRAME_BOUNDS, &r,
> sizeof(RECT)) == S_OK ) {
>
> ^~~~
> make[1]: *** [Fl.o] Error 1
> make: *** [all] Error 1
This error is really unexpected, but I have good news:
I installed a new MinGW version from scratch (mine is somewhat older)
and tried the new installation. With FLTK 1.4 I couldn't see the same
error but I got a related linker error. The I tried FLTK 1.3.4 svn and I
can confirm the error you see. I'm working on a patch.
There are two issues in the current MinGW version:
(1) S_OK is not defined as it was before. A quick workaround is:
#include <winerror.h>
somewhere at the top of src/Fl_win32.cxx. However, this doesn't get you
to a successful build because of issue #2.
(2) There is a (IMHO buggy) inline implementation of a winsock related
function in the latest version of MinGW's winsock.h. This inline
implementation requires us (FLTK) to link explicitly with the winsock
dll (ws2_32) which we tried to avoid by dynamic loading of the library
to reduce dependencies.
Here is my preliminary comment in one of our CMake files:
# The current MinGW version (as of Feb 2018) uses (in winsock.h) an *inline*
# implementation of a winsock library function (__FD_ISSET) that depends on
# __WSAFDIsSet (which is in ws2_32.dll). Hence we need to link with winsock2
# (ws2_32.lib) explicitly although we load all winsock functions we use
# dynamically to avoid to have to link to winsock2. Otherwise we
# get a linker error when linking fluid and/or our test programs.
# Unfortunately user programs may be affected as well.
# Note: This is a bug in the latest MinGW implementation. :-(
# AlbrechtS - Feb 08, 2018
> I have already installed the win32api package for mingw and msys as well
> - I see the relevant headers in C:\MinGW\include and
> C:\MinGW\msys\1.0\include\w32api
>
> Can't quite figure out what is going wrong - any ideas?
Looks as if you didn't make a mistake, it's an issue introduced by the
latest MinGW implementation.
BTW: The same issue (at least #2 above) applies to FLTK 1.4.0 as well.
I'll post a patch ASAP once I did some more tests.
@Ian and other devs and users: take care (make a backup) before updating
your MinGW installation. See my analysis above. There may be other
issues I didn't find yet.