The steps below assume that you are working at the Galileo's command prompt (not the Arduino IDE).
To build the shared library:
- gcc -c -Wall -fpic smbus.c (create smbus.o object file in PIC format, show all warnings)
- gcc -shared -o libsmbus.so smbus.o (create shared library .so file. Name of .so file must start with lib)
Put the library where gcc can find it:
- cp libsmbus.so /usr/lib/
- chmod 0755 /usr/lib/libsmbus.so
- cp smbus.h /usr/include
To use this library with gcc, include -lsmbus in the gcc commmand line, like this -
gcc -Wall -lm -lsmbus -o bmp085 bmp085.c
Note how the library name after -l matches the name of the library file minus the lib prefix and the .so file extension. -lm is the switch for including the standard math library that my program uses.
I'll post my C code for reading barometric pressure using the BMP085 separately.