On Tue, Sep 6, 2011 at 10:04 PM, Xiaofan Chen <[email protected]> wrote: > On Sun, Sep 4, 2011 at 9:24 PM, Xiaofan Chen <[email protected]> wrote: >> 1) bitbang_ft2232.c >> >> $ gcc -o bitbang_ft2232 bitbang_ft2232.c -lftdi >> bitbang_ft2232.c: In function 'main': >> bitbang_ft2232.c:73:9: warning: '_sleep' is deprecated (declared at >> d:\mingw\bin >> \../lib/gcc/mingw32/4.5.2/../../../../include/stdlib.h:400) >> bitbang_ft2232.c:80:9: warning: '_sleep' is deprecated (declared at >> d:\mingw\bin >> \../lib/gcc/mingw32/4.5.2/../../../../include/stdlib.h:400) >> bitbang_ft2232.c:87:9: warning: '_sleep' is deprecated (declared at >> d:\mingw\bin >> \../lib/gcc/mingw32/4.5.2/../../../../include/stdlib.h:400) >> bitbang_ft2232.c:94:9: warning: '_sleep' is deprecated (declared at >> d:\mingw\bin >> \../lib/gcc/mingw32/4.5.2/../../../../include/stdlib.h:400) >> >> This is because of the following. >> #ifdef __WIN32__ >> #define sleep(x) _sleep(x) >> #endif >> >> Change to the following and it will be okay. >> >> #ifdef __WIN32__ >> #define sleep(x) Sleep(x) >> #endif >> >> 2) serial_test.c >> >> $ gcc -o serial_test serial_test.c -lftdi >> D:\Users\mcuee\AppData\Local\Temp\ccy2M0IH.o:serial_test.c:(.text+0x582): >> undefi >> ned reference to `sleep' >> collect2: ld returned 1 exit status >> >> Add the following will fix the issue. >> >> #ifdef __WIN32__ >> #define sleep(x) Sleep(x) >> #endif > > > patches here. > > diff --git a/examples/bitbang_ft2232.c b/examples/bitbang_ft2232.c > index 6eb223e..7b8d811 100644 > --- a/examples/bitbang_ft2232.c > +++ b/examples/bitbang_ft2232.c > @@ -12,7 +12,7 @@ > #include <stdlib.h> > #include <unistd.h> > #ifdef __WIN32__ > -#define sleep(x) _sleep(x) > +#define sleep(x) Sleep(x) > #endif > #include <ftdi.h> > > diff --git a/examples/serial_test.c b/examples/serial_test.c > index afdc07c..c315f15 100644 > --- a/examples/serial_test.c > +++ b/examples/serial_test.c > @@ -8,6 +8,9 @@ > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > +#ifdef __WIN32__ > +#define sleep(x) Sleep(x) > +#endif > #include <getopt.h> > #include <signal.h> > #include <ftdi.h> >
The patch is still good for libftdi-0.20 and libftdi-0.x git. I think it is good to be applied. -- Xiaofan -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
