Compilation terminated with exit code: 2

Hi,

I want my application to run in cloud so used “JsonParserGeneratorRK.h” but on compilation giving error as shown below:-

“…/…/…/build/target/user/platform-12-m/Device2/\libuser.a(JsonParserGeneratorRK.o):c:/Prasoon_Personal/Technical/Particles/Device2/Device2/lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.cpp:551: first defined here
…/…/…/build/target/user/platform-12-m/Device2/\libuser.a(JsonParserGeneratorRK.o): In function JsonReference::~JsonReference()': c:/Prasoon_Personal/Technical/Particles/Device2/Device2/lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.cpp:551: multiple definition of vtable for JsonWriter’
…/…/…/build/target/user/platform-12-m/Device2/\libuser.a(JsonParserGeneratorRK.o):c:/Prasoon_Personal/Technical/Particles/Device2/Device2/lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.cpp:551: first defined here
…/…/…/build/target/user/platform-12-m/Device2/\libuser.a(JsonParserGeneratorRK.o): In function JsonReference::~JsonReference()': c:/Prasoon_Personal/Technical/Particles/Device2/Device2/lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.cpp:551: multiple definition of vtable for JsonModifier’
…/…/…/build/target/user/platform-12-m/Device2/\libuser.a(JsonParserGeneratorRK.o):c:/Prasoon_Personal/Technical/Particles/Device2/Device2/lib/JsonParserGeneratorRK/src/JsonParserGeneratorRK.cpp:551: first defined here
collect2.exe: error: ld returned 1 exit status
make[2]: *** […/…/…/build/module.mk:232: c:/Prasoon_Personal/Technical/Particles/Device2/Device2/target/1.5.4-rc.1/argon/Device2.elf] Error 1
make[1]: *** […/build/recurse.mk:12: modules/argon/user-part] Error 2
make: *** [C:\Users\ptewari.particle\toolchains\buildscripts\1.9.2\Makefile:54: compile-user] Error 2
The terminal process terminated with exit code: 2”

Any help highly appreciated.

Have you tried the clean task before building again?
I got the feeling the log above is only part of the output, but what I can see suggests there are some re-definition errors that may cause the build to fail.

Also, how does your project file tree look?
Could it be that there are multiple instances of the library in that project?

2 Likes

You would also get that error if you copied the JsonParserGeneratorRK.cpp file into your project directly but it was still in the libs directory.

Hi ScruffR,

After cleaning compilation was successful and after flashing my data start publishing in cloud. Thanks for support.

Regards,
Prasoon Tewari

2 Likes