无法编译 Arduino CapSense 示例 [英] Can't compile Arduino CapSense example

查看:27
本文介绍了无法编译 Arduino CapSense 示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 用于 Arduino 的 CapSense 库.但是,我无法运行包中包含的名为CapSenseSketch"的示例.当我尝试打开文件并运行它时(我已经尝试过 Arduino 1.0 和 1.0.1),我收到一个编译器错误,提示CapSense 没有命名类型",还有

I'm trying to work with the CapSense library for Arduino. However, I can't manage to run the example included with the package, called "CapSenseSketch". When I try just opening the file and running it (I've tried both Arduino 1.0 and 1.0.1), I get a compiler error that says 'CapSense does not name a type", and also

CapSenseSketch.cpp:1:22: error: CapSense.h: No such file or directory
CapSenseSketch:11: error: 'CapSense' does not name a type
CapSenseSketch:12: error: 'CapSense' does not name a type
CapSenseSketch:13: error: 'CapSense' does not name a type
CapSenseSketch.cpp: In function 'void setup()':
CapSenseSketch:17: error: 'cs_4_2' was not declared in this scope
CapSenseSketch.cpp: In function 'void loop()':
CapSenseSketch:24: error: 'cs_4_2' was not declared in this scope
CapSenseSketch:25: error: 'cs_4_6' was not declared in this scope
CapSenseSketch:26: error: 'cs_4_8' was not declared in this scope

代码顶部有一个include语句,

There is an include statement at the top of the code,

#include <CapSense.h>

我认为这就是问题所在,所以我将括号更改为引号,但仍然出现错误提示编译错误"和:

and I thought that would be the problem, so I changed the brackets to quotes and still got an error saying "Error compiling" and:

CapSenseSketch.cpp.o: In function `__static_initialization_and_destruction_0':
CapSenseSketch.cpp:15: undefined reference to `CapSense::CapSense(unsigned char, unsigned char)'
CapSenseSketch.cpp:16: undefined reference to `CapSense::CapSense(unsigned char, unsigned char)'
CapSenseSketch.cpp:17: undefined reference to `CapSense::CapSense(unsigned char, unsigned char)'
CapSenseSketch.cpp.o: In function `loop':
CapSenseSketch.cpp:28: undefined reference to `CapSense::capSense(unsigned char)'
CapSenseSketch.cpp:29: undefined reference to `CapSense::capSense(unsigned char)'
CapSenseSketch.cpp:30: undefined reference to `CapSense::capSense(unsigned char)'
CapSenseSketch.cpp.o: In function `setup':
CapSenseSketch.cpp:21: undefined reference to `CapSense::set_CS_AutocaL_Millis(unsigned long)'

有什么想法吗?我曾在另一台计算机上使用 CapSense,当时将括号更改为引号效果很好,但现在似乎没什么用.

Any ideas? I've worked with CapSense on another computer and changing the brackets to quotes worked fine that time, but it doesn't seem to be doing much now.

推荐答案

显然在 arduino ide 中包含外部文件的工作方式略有不同.仅仅在代码顶部有一个包含语句是不够的,您必须手动转到草图>为要使用的每个外部文件添加文件.就我而言,我只对我尝试使用的两个文件中的一个执行了此操作.

Apparently including external files works a bit differently in the arduino ide. It's not enough to simply have an include statement at the top of your code, you must instead manually go to sketch > add file for every external file you want to use. In my case, I only did this for one out of the two files I was trying to use.

这篇关于无法编译 Arduino CapSense 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆