libftdi Archives

Subject: Re: Compile error on MinGW

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 5 Feb 2021 09:48:31 +0800
On Thu, Feb 4, 2021 at 1:26 PM Xiaofan Chen <xiaofanc@xxxxxxxxx> wrote:
>
> On Wed, Feb 3, 2021 at 8:25 PM <drfiemost@xxxxxxxx> wrote:
> >
> > > > Found out that this happens because I use WIN32_LEAN_AND_MEAN
> > > > which prevents the definition of struct timeval.
> > > > I can workaround this problem but think that it should be handled in the
> > > > ftdi.h header,
> > > > either undefining WIN32_LEAN_AND_MEAN before windows.h is included or by
> > > > explicitly including Winsock2.h.
> > > > What do you think?
> > >
> > > Just wondering which MinGW version you are using?  I had no problem 
> > > building
> > > libftdi under MSYS2 distribution of MinGW-w64 (32/64bit).
> > >
> >
> > I'm on the 64 bit version of MSYS2/MinGW64, using the 
> > mingw64/mingw-w64-x86_64-libftdi 1.5-1 package.
>
> I see. In this case, you use WIN32_LEAN_AND_MEAN in your code and that is
> causing problems with ftdi.h header.
>
> I think we should not change ftdi.h but rather your code may need to have
> the workaround.

On the other hand, I can see libusb.h does explicitly include
winsock.h (not winsock2.h).
https://github.com/libusb/libusb/blob/master/libusb/libusb.h

So maybe this is a good idea to explicitly include winsock.h or
winsock2.h (incompatible
with each other).

BTW, libusb.h also has the calling convention for Windows (#define
LIBUSB_CALL WINAPI)
to make binaries (DLL) compatible from different compilers.

-- 
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread