3

我是嵌入式开发的新手,我遇到了一个无法通过阅读文档来解决的问题。我正在开发一个 IOT 项目作为学校作业的一部分。我有一个包含项目源代码的 github 存储库,我正在尝试设置 Travis CI。当所有代码都位于 main.cpp 文件中时,一切正常,但是在将部分代码移动到lib目录中的单独类之后,构建一直失败。问题是它找不到我的课程。

英语不是我的母语,所以可能是我误解了文档中的某些内容。有没有人知道我做错了什么?我将不胜感激任何帮助或建议,也许是我应该仔细查看的文档的一部分,在此先感谢!

我的存储库WaterUp-PlantPot的链接

src/main.cpp:9:82: fatal error: MQTT.h: No such file or directory
#include <MQTT.h>

我的目录结构

|--lib
|  |--MQTT
|  |  |- MQTT.cpp
|  |  |- MQTT.h 
|  |--Sensors
|  |  |- Sensors.cpp
|  |  |- Sensors.h
|- platformio.ini
|- .travis.yml
|--src
   |- main.c

main.cpp 文件:

#include <Arduino.h>
#include <MQTT.h>
#include <Sensors.h>
MQTT mqtt; // Create an new MQTT object for communication with the broker.
Sensors sensors; // Create an new  Sensors object for taking measurements about the pot state.

void setup()
{
    Serial.begin(115200); // Start serial communication for sending debug messages to the serial port.
    delay(10);
    mqtt.setup( &sensors ); // Setup the mqtt library.

}

void loop()
{
    mqtt.mqttConnect(); // Connect to the broker if the connection is lost.
    mqtt.runLoop(); // Run the main program.
}

我的 travis.yml 文件:

language: python
python:
    - "2.7"
sudo: false
cache:
    directories:
        - "~/.platformio"
env:
    - PLATFORMIO_CI_SRC=./src/main.cpp

install:
    - pip install -U platformio
    - platformio lib -g install "Adafruit MQTT Library"
    - platformio lib -g install Streaming
script:
     - platformio ci --board=huzzah
4

0 回答 0