Susan M Susan M - 1 year ago 122
C Question

atinout compilation error

I've been trying to run AT commands project, and have read many threads to ease the trouble. atinout (C-Program) offers lot of hope. But when I try to compile it with Turbo C++ I get the following error:

Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
Error atinout.c 81: Declaration syntax error
*** 1 errors in Compile ***

Actual Program (Many thanks to expert Håkon Løvdal, for making it)
Sorry, I've not put the entire code here.

Line 81: Starts at
static bool tr_lf_cr(const char *s)

/* Replace '\n' with '\r', aka `tr '\012' '\015'` */
static bool tr_lf_cr(const char *s)
char *p;
p = strchr(s, '\n');
if (p == NULL || p[1] != '\0') {
return false;
*p = '\r';
return true;

Answer Source

user3629249 is spot on with the comment's first suggestion; the problem for tcc is the bool type. Turbo C++ 3.00 is an older compiler that only supports the C language from when it was standardized in 1990 ("ISO/IEC 9899:1990" aka C89 or C90), and the stdbool header file and corresponding boolean type was introduced in 1999 ("ISO/IEC 9899:1999" aka C99).

To make the code compile you can add the following at the beginning of the file:

#define bool int
#define true 1
#define false 0

however that will only give you a binary that run on Intel/AMD computers. Most likely your android device will be running an ARM CPU, so in order to make a binary that can be run in the adb shell you need to compile it with a cross compiler. I have not done this myself so I am unable to give any further assistance on that.

On a side note, I am in the process of converting the atinout project to use autoconf/automake + gnulib. Not because I am a huge fan, but it will support portability issues like stdbool largely out of the box and make cross compilation relatively easy. But do not hold your breath waiting for this to be finished.