When attempting to compile libftdi on FreeBSD, the lack of stdlib.h in the example programs prevents them from compiling:

     simple.c: In function 'main':
simple.c:18: error: 'EXIT_FAILURE' undeclared (first use in this function)
     simple.c:18: error: (Each undeclared identifier is reported only once
     simple.c:18: error: for each function it appears in.)
simple.c:43: error: 'EXIT_SUCCESS' undeclared (first use in this function)
     *** Error code 1

Attached is a set of patches that adds the missing include to the sources in examples that need it.

                Craig



--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]   
--- examples/baud_test.c.orig   2012-07-28 21:59:25.000000000 -0700
+++ examples/baud_test.c        2012-07-28 21:59:31.000000000 -0700
@@ -31,6 +31,7 @@
 
 #include <sys/time.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <ftdi.h>
 
--- examples/bitbang.c.orig     2012-07-28 21:58:19.000000000 -0700
+++ examples/bitbang.c  2012-07-28 21:58:24.000000000 -0700
@@ -1,6 +1,7 @@
 /* This program is distributed under the GPL, version 2 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define sleep(x) Sleep(x)
--- examples/bitbang2.c.orig    2012-07-28 21:58:31.000000000 -0700
+++ examples/bitbang2.c 2012-07-28 21:58:37.000000000 -0700
@@ -30,6 +30,7 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define usleep(x) Sleep((x+999)/1000)
--- examples/bitbang_ft2232.c.orig      2012-07-28 21:58:49.000000000 -0700
+++ examples/bitbang_ft2232.c   2012-07-28 21:58:57.000000000 -0700
@@ -9,6 +9,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #ifdef __WIN32__
 #define sleep(x) _sleep(x)
--- examples/find_all.c.orig    2012-07-28 21:59:06.000000000 -0700
+++ examples/find_all.c 2012-07-28 21:59:13.000000000 -0700
@@ -6,6 +6,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ftdi.h>
 
 int main(void)
--- examples/simple.c.orig      2012-07-28 21:57:41.000000000 -0700
+++ examples/simple.c   2012-07-28 21:58:02.000000000 -0700
@@ -6,6 +6,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ftdi.h>
 
 int main(void)

Reply via email to