Pages: [1]   Go Down
Author Topic: difference with Jantje's Great pluging and Arduino ide 1.5.2  (Read 476 times)
0 Members and 1 Guest are viewing this topic.
Heemskerk, Netherlands
Offline Offline
Sr. Member
****
Karma: 10
Posts: 406
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I posted this topic also in another forum (As it concerns ArduinoJson). It seems there is a difference in the way th eplugin is compiling/linking and the IDE direct. Or I am just being plain stupid (which of course is also a valid statement smiley-mr-green smiley-mr-green)

Btw I am using Baeyens plugin version : 2.2.0.201407120208

This is the message:

No doubt it is me  smiley-mr-green But, I tried to compile this example under Eclipse using Arduino IDE 1.5.2 and Jantjes plugin and I am getting a bunch of linker errors :
Code:
Starting combiner
"D:/Arduino/hardware/tools/avr/bin/avr-gcc" -Os -Wl,--gc-sections -mmcu=atmega328p -o "D:/workspace/ArduinoJsonTest/Release/ArduinoJsonTest.elf"    ./ArduinoJsonTest.cpp.o  ./Libraries/ArduinoJson/JsonGenerator/EscapedString.cpp.o ./Libraries/ArduinoJson/JsonGenerator/JsonArrayBase.cpp.o ./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o ./Libraries/ArduinoJson/JsonGenerator/JsonValue.cpp.o ./Libraries/ArduinoJson/JsonGenerator/Print.cpp.o ./Libraries/ArduinoJson/JsonGenerator/StringBuilder.cpp.o  ./Libraries/ArduinoJson/JsonGenerator.cpp.o   D:/workspace/ArduinoJsonTest/Release/arduino.ar   "D:/workspace/ArduinoJsonTest/Release/arduino.ar" "-LD:/workspace/ArduinoJsonTest/Release" -lm
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonArrayBase::printTo(Print&) const':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonArrayBase.cpp:11: multiple definition of `ArduinoJson::Generator::JsonArrayBase::printTo(Print&) const'
./Libraries/ArduinoJson/JsonGenerator/JsonArrayBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonArrayBase.cpp:11: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Internals::StringBuilder::write(unsigned char)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/StringBuilder.cpp:10: multiple definition of `ArduinoJson::Internals::StringBuilder::write(unsigned char)'
./Libraries/ArduinoJson/JsonGenerator/StringBuilder.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/StringBuilder.cpp:10: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonValue::printPrintableTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:22: multiple definition of `ArduinoJson::Generator::JsonValue::printPrintableTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)'
./Libraries/ArduinoJson/JsonGenerator/JsonValue.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:22: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonValue::printBoolTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:12: multiple definition of `ArduinoJson::Generator::JsonValue::printBoolTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)'
./Libraries/ArduinoJson/JsonGenerator/JsonValue.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:12: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Internals::EscapedString::printTo(char const*, Print&)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/EscapedString.cpp:33: multiple definition of `ArduinoJson::Internals::EscapedString::printTo(char const*, Print&)'
./Libraries/ArduinoJson/JsonGenerator/EscapedString.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/EscapedString.cpp:33: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonValue::printStringTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:30: multiple definition of `ArduinoJson::Generator::JsonValue::printStringTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)'
./Libraries/ArduinoJson/JsonGenerator/JsonValue.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:30: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonObjectBase::printTo(Print&) const':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:14: multiple definition of `ArduinoJson::Generator::JsonObjectBase::printTo(Print&) const'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:14: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonValue::printLongTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:17: multiple definition of `ArduinoJson::Generator::JsonValue::printLongTo(ArduinoJson::Generator::JsonValue::Content const&, Print&)'
./Libraries/ArduinoJson/JsonGenerator/JsonValue.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonValue.cpp:17: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonObjectBase::getMatchingPair(char const*) const':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:42: multiple definition of `ArduinoJson::Generator::JsonObjectBase::getMatchingPair(char const*) const'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:42: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonObjectBase::remove(char const*)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:86: multiple definition of `ArduinoJson::Generator::JsonObjectBase::remove(char const*)'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:86: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonObjectBase::containsKey(char const*) const':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:83: multiple definition of `ArduinoJson::Generator::JsonObjectBase::containsKey(char const*) const'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:83: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o: In function `ArduinoJson::Generator::JsonObjectBase::operator[](char const*)':
D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:57: multiple definition of `ArduinoJson::Generator::JsonObjectBase::operator[](char const*)'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:57: first defined here
./Libraries/ArduinoJson/JsonGenerator.cpp.o:(.bss._ZN11ArduinoJson9Generator14JsonObjectBase9nullValueE+0x0): multiple definition of `ArduinoJson::Generator::JsonObjectBase::nullValue'
./Libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp.o:D:/Documents/Arduino/libraries/ArduinoJson/JsonGenerator/JsonObjectBase.cpp:42: first defined here
make: *** [ArduinoJsonTest.elf] Error 1

The example is this one:
Code:
/*
 * Arduino JSON library - Generator example
 * Benoit Blanchon 2014 - MIT License
 */

#include "Arduino.h"
#include <JsonGenerator.h>

using namespace ArduinoJson::Generator;

void setup()
{
    Serial.begin(9600);

    JsonArray<2> array;
    array.add<6>(48.756080); // 6 is the number of decimals to print
    array.add<6>(2.302038);  // if not specified, 2 digits are printed

    JsonObject<3> root;
    root["sensor"] = "gps";
    root["time"] = 1351824120;
    root["data"] = array;

    Serial.print(root); // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
}

void loop()
{

}

Any tips where I missed the boat smiley-mr-green

@edit: This is interesting. If I compile it direct in the IDE 1.5.2 it works fine....
« Last Edit: August 25, 2014, 01:45:25 pm by nicoverduin » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

eclipse 4.3.2, arduino ide 1.5.6, Baeyens plugin 2.2.0.1, ArduinoJson 58c051f564

having the very same issue with the very same lib (https://github.com/bblanchon/ArduinoJson): with the Arduino IDE, this lib works quite fine, but using eclipse with Baeyenes leads to the described errors.

Usually the plugin lib-importer works fine with private library paths and other 3rd libs, but i just cannot get this one to compile with this development setup. Not understanding the mechanics under the hood, i'd assume as well that eclipse is handling the imports and paths slightly different at linking time?...

please update this thread if you find any solution :)

cheers



« Last Edit: September 01, 2014, 05:56:46 pm by maldex » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 5
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi nicoverdim,

I saw your message yesterday on the other thread.
Here is a copy of my answer.

To make the library work properly with the Arduino IDE, I added 4 files at the root:
  • JsonGenerator.cpp
  • JsonGenerator.h
  • JsonParser.cpp
  • JsonParser.h

If you open them, you'll see that they only contain #include of the files in the subfolders.
That's a workaround for the Arduino IDE, because it doesn't look for files in the subfolders.

Unfortunately for you, Eclipse does   smiley-razz
I suggest you remove the two .cpp files at the root or exclude them from the build.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

or, fix these includes. how was that about never include .cpp files? smiley

edit JsonParser.cpp and JsonGenerator.cpp in the root folder, and replace all includes to the .h counterparts.

Code:
#include "JsonParser/JsonArray.h" // #include "JsonParser/JsonArray.cpp"
#include "JsonParser/JsonObject.h" // #include "JsonParser/JsonObject.cpp"
#include "JsonParser/JsonParserBase.h" // #include "JsonParser/JsonParserBase.cpp"
...

Hey BenoitB: thanks for your excellent work, saves me a lot of trouble smiley
Logged

Pages: [1]   Go Up
Jump to: