Ftdilib已安装,但ftdi_enable_bitbang "was not declared in this scope"
Ftdilib installed but ftdi_enable_bitbang "was not declared in this scope"
我安装了ftdilib,我正在尝试编译以下代码:
/* hello-ftdi.c: flash LED connected between CTS and GND.
This example uses the libftdi API.
Minimal error checking; written for brevity, not durability. */
#include <stdio.h>
#include <ftdi.h>
#define LED 0x08 /* CTS (brown wire on FTDI cable) */
int main()
{
unsigned char c = 0;
struct ftdi_context ftdic;
/* Initialize context for subsequent function calls */
ftdi_init(&ftdic);
/* Open FTDI device based on FT232R vendor & product IDs */
if(ftdi_usb_open(&ftdic, 0x0403, 0x6001) < 0) {
puts("Can't open device");
return 1;
}
/* Enable bitbang mode with a single output line */
ftdi_enable_bitbang(&ftdic, LED);
/* Endless loop: invert LED state, write output, pause 1 second */
for(;;) {
c ^= LED;
ftdi_write_data(&ftdic, &c, 1);
sleep(1);
}
}
但是有错误:ftdi_enable_bitbang没有在这个范围内声明这是唯一的错误。
为什么这个总是跳出来?
快速查看一下当前版本的ftdi.h,就会发现ftdi_enable_bitbang没有声明。Ftdi_enable_bitbang在被弃用两年后已被删除。请使用ftdi_set_bitmode
相关文章:
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 删除分配的 (?) 指针时"Pointer being freed was not allocated"
- 类中的数组变量C++导致"was not declared in this scope"实现文件的一个函数中错误,但在构造函数中不会导致错误
- 如何解决"cout was not declared in this scope"错误?
- 为什么程序显示我"was not declared in this scope"?
- 为什么我会收到"getuid was not declared in that scope"错误?
- 为什么我会收到此警告? "Member 'x' was not initialized in this constructor"
- 即使包含 <time.h 后仍"‘CLOCK_PER_SEC’ was not declared in this scope"错误>
- 我正在接受"Error: string was not declared in this scope"
- C++编译错误,"malloc: *** error for object: pointer being freed was not allocated"
- 创建一个移动分配函数,不断得到"pointer being freed was not allocated"
- C++ 我一直在"was not declared in this scope error"
- NDK r16b 独立工具链错误:"/usr/bin/ld: this linker was not configured to use sysroots"
- assimp-vc140-mt.dll ASSIMP was not found
- 将 .ui 文件导入 Qt5 C++时出错"was not declared in this scope"
- 如何从类调用函数 - 错误"was not in the scope"
- 编译 CPP 应用程序时出错。 "error: 'posix_memalign' was not declared in this scope"
- libcurl-x64.dll was not found
- 解析 csv 文件,"malloc: *** error for object 0x7ffeeb4f4b80: pointer being freed was not allocated"出现此错误
- C++ "pointer being freed was not allocated"