lis2dh12 example fails to compile on Artemis Dev Kit

Hi,

I am trying to compile the ‘BasicReadings’ example for the LIS2DH12 with my Board set to the Artemis Dev Kit. I am getting a bunch of multiple definition errors like:

c:/users/lyla caudle/appdata/local/arduino15/packages/sparkfun/tools/arm-none-eabi-gcc/8-2018-q4-major/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Lyla Caudle\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.1.1\variants\SFE_ARTEMIS_DK/mbed/libmbed-os.a(lis2dh12_reg.o): in function `lis2dh12_write_reg':

lis2dh12_reg.c:(.text.lis2dh12_write_reg+0x0): multiple definition of `lis2dh12_write_reg'; libraries\SparkFun_LIS2DH12_Arduino_Library\lis2dh12_reg.cpp.o:lis2dh12_reg.cpp:(.text.lis2dh12_write_reg+0x0): first defined here

If I am reading this right it looks like the apollo3 package has its own copy of the library which is creating the conflict.

Any suggestions on how to resolve it?

Thanks,

Phil

It looks like that error occurs when the #include section references a .cpp instead of the expected .h header file; check out https://stackoverflow.com/questions/637 … ect=1&lq=1 (which is different but similar)

Yah, I saw that post but I don’t think that’s the problem here. I don’t see any includes like that in the demo code. Presumably this code normally compiles for other boards so I suspect it is a problem specific to the Artemis

prittenhouse:
Presumably this code normally compiles for other boards so I suspect it is a problem specific to the Artemis

Sorry, I meant to say I suspect the problem is specific to the Apollo 3 Arduino library. Has anyone build this example with the latest libraries recently?

Thanks,

Phil

Hmmmm… it seems I can’t edit my post. Let me try again

I meant to say I suspect the problem is related to the Artemis Arduino library. Has anyone built this example with the latest libraries recently? The Getting Started guide https://learn.sparkfun.com/tutorials/ge … e-overview says to install the Sparkfun LIS2DH12 library but I’m wondering if the two libraries are not compatible.

Hi, I may be late to this party, but I was wondering if you found your solution to this. I just ran into this problem recently. I was able to finally get it to work by going into the LIS2DH12 library and removing the LIS2DH12_reg.cpp and LIS2DH12_reg.h files. That way the SPARKFUN_LIS2DH12 import doesn’t try to import both conflicting libraries.

The library files are in C:\Users<user_name>\Documents\Arduino\libraries\SparkFun_LIS2DH12_Arduino_Library\src. You might just copy the Sparkfun library to an Artemis_Sparkfun library and remove the files from that one so that you can just import that new one for the Artemis and import the original for other processors.

They apparently added the driver to rhe mbed art of the apollo files, and kept the same function names. I renamed all the functions in the lib and it works now…Sparkfun why didnt you respond to these people and tell them this? Also the upload button still doesnt work for the devkit. I posted a workable solution ages ago. Very dissapointed in the support you offer your customers on the apollo product line.