Skip to content

How to properly use libraries and OOP? #38

@UsoHolger

Description

@UsoHolger

This is a question. Not really sure whether to ask this here or in Arduino-Makefile.

I personally don't really care about compatability to the arduino IDE I just want to use theire libraries. With this repo and the makefile I kind of have what I wanted except for the way libraries are compiled, which I do not understand fully.

By reading the code I found that the folder names of libraries have to be the same as the .h and .cpp file and there can only be one .h and one .cpp file per library is that correct?

So I like clean OOP with files for each class, I know one should not go to heavily object oriented for hardware programming but from what I have read it is okay as long as one does not use polymorphy etc. since the compiler can't optimize that. And not to use the heap to much. So what I do is create one "library" for each class and create objects in the main file as global variables, is that the way to do it?

I tried to play around with StandardCplusplus but could not make it work in this framework even though I tried to edit the regex in the Arduino-Makefile to account for the missing .h. I am not saying I want to use the bloated container classes but e.g. functional would be nice to have. So just as an example: How would I make such a library with multiple .cpp and header files work, is that even possible without changing the entire makefile?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions