gpt4 book ai didi

c - atiout 编译错误

转载 作者:太空宇宙 更新时间:2023-11-04 04:31:43 24 4
gpt4 key购买 nike

我一直在尝试运行 AT 命令项目,并阅读了很多主题以减轻麻烦。 atinout (C-Program)提供了很多希望。但是当我尝试使用 Turbo C++ 编译它时,出现以下错误:

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

实际程序(非常感谢专家 Håkon Løvdal 的制作)抱歉,我没有将整个代码放在这里。

第 81 行:开始于 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;
}

最佳答案

user3629249评论的第一个建议是正确的; tcc 的问题是 bool 类型。 Turbo C++ 3.00 是一个较旧的编译器 only supports standardized 时的 C 语言1990 年(“ISO/IEC 9899:1990”又名 C89 或 C90),1999 年引入了 stdbool 头文件和相应的 bool 类型(“ISO/IEC 9899:1999”又名 C99)。

要编译代码,您可以在文件开头添加以下内容:

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

然而,这只会为您提供在 Intel/AMD 计算机上运行的二进制文件。您的 android 设备很可能会运行 ARM CPU,因此为了生成可以在 adb shell 中运行的二进制文件,您需要使用交叉编译器对其进行编译。我自己没有这样做,所以我无法就此提供任何进一步的帮助。


附带说明一下,我正在将 atinout 项目转换为使用 autoconf/automake + gnulib。不是因为我是它的 super 粉丝,而是它会支持可移植性问题,比如 stdbool,它在很大程度上是开箱即用的,并且使交叉编译相对容易。但不要屏住呼吸等待这一切完成。

关于c - atiout 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35491430/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com