How to add a library?

Hi,

I have a C++ class (header and implementation) that I have added to the libraries directory (in AP_foo subdirectory) and I want to use this library from within some modifications I will make to some of the .pde files.

I have an #include <foo.h> in ArduPlane.pde. However the new lib doesn't get added to the include path in compilation, so it fails because of a missing file. Unless I do what?

I don't know this cmake thing too well. I have tried to fire a cmake in the root ardupilot dir, and it prints nicely "Generating Arduino XXX library" for all libraries I can think of except mine. I cannot find a list of the library names getting generated. I suppose generation includes having the libraries generated added to (a superset of) includes for compilation..?

Does somebody know what I can go to get cmake - as used in Ardupilot - to recognize my library or its use?

Regards

Soren

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hi,

    Well I knew C++ for some time but not Arduino....

    Apparently one just has to make a dir named Foo in ardupilot/libaries/ and then put at least Foo.cpp and Foo.h in that dir. Foo is any name of course.

    Create ardupilot/README.txt if not existing. Go to ardupilot/build (or create it if not existing). Run cmake ../ArduPlane . The lib should then be put on the include path for ArduPlane if I understood this right..

    Nothing is compiled at this stage. Only makefiles generated.

    Regards

    Soren

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…