7

Is there a simple way to use libraries intended for the Arduino IDE with the C and assembly code I write for AVR-G++/AVR-GCC?

I'm trying to use the Adafruit Wave Shield library, but simply including the header and cpp files don't do much good. Can I compile it somehow and link it to my C code? Or perhaps just find a way to make it compile with my C code.

Currently, when I try to do something simple like:

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

I am greeted with:

70: undefined reference to `SdReader::init(unsigned char)'

2 Answers 2

3

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

Update: There is also a tutorial, which explains how to setup and use this makefile.

Sign up to request clarification or add additional context in comments.

Comments

2

You can build the Arduino code with CMake. I have built largish Arduino projects without using the IDE this way. You can use whatever tools you want to build the Arduino code, it is just a C/C++ library. You mainly need to make sure you have all of the preprocessor settings right (F_CPU? Maybe some others).

Build using Cmake might 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.

1 Comment

Those links are dead, but this CMake Arduino project still exists: github.com/tttapa/Arduino-AVR-CMake/blob/master/README.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.