I just installed RtMidi for a project and compiled it. The examples in the tests folder work and so does my code if I put it in the folder and include it in the Makefile that compiles all the examples. How can I use RtMidi in a project with #include <RtMidi.h> instead of having my code in the tests folder? More specifically, what should I put in my Makefile? I've read a bit about dynamic and static libraries but I have no idea what I should be looking for. I've tried adding -llibrtmidi and /usr/local/lib/librtmidi.a without success.
Adding a library to a makefile
9.3k Views Asked by Felipe Cortez At
2
There are 2 best solutions below
0
On
Based on your description of your environment, you may require something like
CPPFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
LDLIBS += -lrtmidi
in your Makefile. make uses a lot of these implicit variables.
In a standard Makefile, the
CXXFLAGSmacro defines flags for the C++ compiler. You will need to add-I<path to header directory>to this macro for the compiler to find the RtMidi header files.Then you will need to add
-L<path to lib directory>to the link step of the Makefile so that-lrtmidiwill find the library file. (Note that you omit thelibprefix for the-lcommand)