简体   繁体   中英

Error importing libraries on Arduino IDE

I'm using Arduino UNO and I need to parse a JSON file wich might be quite big considering the microcontroller has only 2k of SRAM. I found this library ( stream_json_reader ) which can process the file char by char and seems suitable for my porpuses. The problem is I can't figure how to import it correctly in the Arduino IDE . So far I have my Documents/Arduino/libraries folder with stream_json_reader and stringutils (available here ). I have modified the stream_json_reader.h file to point to cstringutils.h ( #include "C:/Users/MY_NAME/Documents/Arduino/libraries/stringutils/cstringutils.h" ).

My code looks something like:

#include "stream_json_reader.h"
#include "stringutils.h"

#include <SPI.h>
#include <Ethernet.h>

using namespace lasote;

static const char* queries[] = { "response.current_observation.city", "response.current_observation.temp_c"};
StreamJsonReader jsonreader(queries, 2);

[...]

void setup() {
    // Retrieving JSON file
    [...]
}

void loop()
{
    [...]
    jsonreader.process_char(c);
    [...]
    Serial.println(jsonreader.results[0]);
    Serial.println(jsonreader.results[1]);
}

But I get: ...stringutils/stringutils.h:18: error: expected initializer before '<' token

I have nearly zero experience with Arduino and C++. I don't if the problem is with some #include or if I misplaced the library files.

Thank you in advance.

Disclaimer: I work at biicode.

That is a library ready to use with biicode as explained on this blogpost . Biicode is a C and C++ dependency manager, it has a central online repository and is compatible con VCS.

To use that library, instead of: #include "stream_json_reader.h"

use: #include "lasote/stream_json_reader/stream_json_reader.h"

then execute bii find and bii arduino:build or `bii arduino:upload``to

Here's a getting started guide on biicode and Arduino:

http://docs.biicode.com/arduino/gettingstarted.html

Json-related libraries available in biicode: http://www.biicode.com/search?q=json

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM