libftdi Archives

Subject: Minor issues in the examples for MinGW build

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 4 Sep 2011 21:24:22 +0800
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

-- 
Xiaofan

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

Current Thread