问题描述
我试图与工作。但是,我不能管理运行包含在包中,被称为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
有一个内含的声明code的顶部,
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。这是不够的,只是有你的code顶部的包括语句,你必须手动,而不是去写生>添加文件要使用的每个外部文件。以我为例,我做这一个了两个文件,我试图用的。
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的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!