在C Xcode中未识别oppaty()
openpty() not recognised in C++ Xcode
我发生了一个奇怪的错误,如果我在c程序中使用函数 openpty()
,它会编译确定,但是如果我在C 程序中具有完全相同的代码,我会收到编译器错误:
error: 'openpty' was not declared in this scope
两个Xcode项目在一个文件中具有完全相同的代码(分别为main.c和main.cpp)。
如何解决此错误?
代码:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/select.h>
#include <string.h>
int main (int argc, const char * argv[]) {
int gps_fdm, gps_fds;
char slave_port_name[256];
int open_res = openpty(&gps_fdm, &gps_fds, slave_port_name, NULL, NULL); // compiler error here
return 0;
}
*从我试图包括pty.h
的评论中获取建议。不幸的是,这创建了编译器错误error: pty.h: No such file or directory
。
根据 openpty()
的人页面,您不包括一些假设的" pty.h"。您需要#include <util.h>
。
相关文章:
- 提升 ASIO 无法识别计时器对象
- 从udp接收帧对于人脸识别来说太慢
- 模板类无法识别友元运算符
- std::visit无法识别类型
- 无法识别模板功能
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 如何在LLVM中dyn_cast以识别StoreInst?
- 从不同的附加依赖项中识别等同命名的函数
- C++出现控制台错误.我无法识别源代码的问题
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- Qt:"Q3DScatter"即使包含在内也无法识别
- 使用指针的类识别
- 如何静态识别动态堆分配?
- 为什么C++无法识别我的对象实例化?
- C++ 无法识别创建进程'telnet'
- 识别 2D 矢量C++中的位置
- 如何识别项目是 QT 中的文件还是文件夹
- ESP32 无法识别任何设备已连接到其接入点
- 无法识别 Mac c++ 文件系统库
- 在C Xcode中未识别oppaty()