Using Arduino Libraries with AVR-g ++

Is there an easy way to use libraries designed for the Arduino IDE, with C and build code that I write for AVR-g ++ / AVR-GCC?

I am trying to use the Adafruit Wave Shield library , but just including header and cpp files is not very good. Can I somehow compile it and link to my C code? Or maybe just find a way to make it compile with my C code.

Currently, when I try to do something simple, for example:

#include "WaveHC/WaveHC.h" SdReader card; card.init(); 

Greetings to me:

 70: undefined reference to `SdReader::init(unsigned char)' 
+6
source share
2 answers

I use this makefile to compile all my code for Arduino without using an IDE. You can use both Arduino libs and user libraries in this makefile.

Update . There is also a tutorial that explains how to configure and use this makefile.

+3
source

You can create Arduino code with CMake . I built fairly large Arduino projects without using the IDE in this way. You can use any tools you want to build Arduino code, it's just a C / C ++ library. First of all, you need to make sure that all preprocessor settings are correct (F_CPU? Maybe some others).

Building using Cmake can help you. Basically, I would make a library file for the Arduino library, a library file for the shield library and an EXE file for your code.

+2
source

Source: https://habr.com/ru/post/895287/


All Articles