eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.37k stars 614 forks source link

linking a program with the mraa library doesn't work #1054

Closed jpelletier closed 3 years ago

jpelletier commented 3 years ago

The library has been successfully compiled and installed in /usr/local/lib. We can see all the labels in the .so file with midnight commander. All the files are present, .so files, link files and includes. When trying to link with the library, it fails to find the references.

jpelletier commented 3 years ago

Found a solution!

Content of Makefile:

LDFLAGS=-lmraa
CXXFLAGS=-Wall
TARGETS=touch_switch

all: ${TARGETS}
clean:
        rm -f ${TARGETS}

When running make, this command is generated:

g++ -Wall -lmraa touch_switch.cpp -o touch_switch

Generates undefined references.

If we put -lmraa at the end, it works. g++ -Wall touch_switch.cpp -o touch_switch -lmraa

compile and link are successfull.