How do I install this library for C, linux (preferably to use in codeblocks but if not however else you do it)

126 Views Asked by At

https://github.com/jdourlens/FirmataC I am trying to install this to use on Linux mint, but I don't know how to install it to use. I have downloaded the files and included the headers and source files in a "project" in codeblocks, but it doesn't compile, keeps going into more and more includes within the files to not be found. Personally, alot of github projects/folders for libraries I always find it incredibly hard to use or install it on both windows/linux. If its a generic and common way of installing these libraries, how do I do this?

Errors:

main.c:(.text+0x1b): undefined reference to `firmata_new'
/usr/bin/ld: main.c:(.text+0x2d): undefined reference to `firmata_pull'
/usr/bin/ld: main.c:(.text+0x51): undefined reference to `firmata_pinMode'
/usr/bin/ld: main.c:(.text+0x86): undefined reference to `firmata_digitalWrite'
/usr/bin/ld: main.c:(.text+0x9e): undefined reference to `firmata_digitalWrite'
1

There are 1 best solutions below

5
On BEST ANSWER

The FirmataC project comes with a Makefile, which allows you to build the library. To do so, clone the project and run make in the project directory. Then, you can link to this library when you compile by running gcc main.c -L <path-to-clone-dir> -I <path-to-clone-dir>/inclues -lfirmatac -o main where ` is the path to which you cloned the FirmataC project.

It is also good to note that many Makefiles (but not this one) will provide a make install command, which allows you to install the library on a system level. If you are using a library that allows it, running make install allows you to simply do gcc main.c -l<library-name> -o main.