I like to use AS7 to make my programs. I know c and some c++, but how things work from there I'm green. I would like to know if there is a folder where I can store my own homemade c and h library files where they get to be available for all my projects. Now I copy all the files into each of my projects and this works but I find it a bit tedious.

1 Answer 1


You should create your library as a separate project: File->New->Project and select C or C++ static library:

creating c++ static library

Add your library modules in this project. When building, this will create lib{your_project_name}.a file (in Debug or Release folder) - your library object file you can use in your other projects.

Usually I include in the same solution both the library project and target project (just library project file, sure the library and it's files resides in single place):

project solution

ORDO is the library name.

Some check list:

  • Include the library file in Libraries folder (shown above)
  • Specify the path to the library *.a file for linker (Toolchain->AVR/GNU Linker->Libraries). Note that there should be different paths for Debug and Release configurations.
  • Specify the path for library include files (Toolchain->AVR/GNU C or C++ Compiler->Directories)
  • In some cases, F_CPU definition might be needed for library project too (same as in your project, under Symbols).
  • When changes are made in your library files, use Build solution (F7) when building, if not - you can use Build project (which will be faster).

Setting project dependencies shall also lead to rebuilding the library automatically when needed (not tested, I usually just hit F7 :).

  • Thank you for a good answer, I belive i see where to begin now. just as to what to do next, lets say you wanted to make a reusable library for those ds18B20 sensors I see you got there... I have googled around trying to find out how to do this but I cant seem to find any that enlighten me.
    – Hans Neve
    Mar 19, 2016 at 16:09
  • I used library from Davide Gironi: davidegironi.blogspot.com/2014/09/… - it has no external onewire module, it is basic, minimalistic, doesn't support bus enumeration etc but might be good starting point to implement own.
    – Flanker
    Mar 19, 2016 at 16:25
  • Nice idea, but what if my own library has Arduino dependencies? I get stuck at this point, because of course requires the Arduino core stuff
    – thexeno
    Apr 25, 2017 at 17:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.