there is not anything like "-I/usr/local/include -lraspicam -lmmal -lmmal_core -lmmal_util"
As KennetRunner points out this is because those libraries aren't in the linker's default path. IfIt is worth mentioning that there are two of these to consider, the linker used at compile time and the shared object linker used at runtime if there are shared libraries linked (which there usually are).
The paths searched by the compile time linker are essentially hardcoded into it, so you don't wantneed to keep usingexplicitly use -L/opt/vc/lib
, you.
You then need to make sure the runtime linker can alsofind the relevant libraries. To add a path for that:
sudo touchbash echo /opt/vc/lib/ > /etc/ld.so.conf.d/opt-vc.conf
Then edit that file (via sudo whatever, or sudoedit
, or just su
to do the whole thing) to include the line:
/opt/vc/lib
Then run sudo ldconfig
to update the linker cache, and to verify,
sudo ldconfig -p | grep mmal
(see man ldconfig
about -p
). You should see a few lines about those libraries.
If the base C includes are useful too (in addition to those of the C++ wrapper library in /usr/local/include
), those won't be in the compiler's default path, so you could use -I /opt/vc/include
or else add to your environment:
CPLUS_INCLUDE_PATH=/opt/vc/include
If you already have such a path set you can expand it the way you would expand the ordinary path variable (e.g. CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/opt/vc/include
).