I have been trying to compile the sample RaspiCam program provided on their project page. When I try to compile the code using the following:

g++ simpletest_raspicam.cpp -o simpletest_raspicam -L/opt/vc/lib -I/usr/local/include -lraspicam -lmmal -lmmal_core -lmmal_util

I get the following errors:

/tmp/ccLyTfLB.o: In function `main':
simpletest_raspicam.cpp:(.text+0x1c): undefined reference to `raspicam::RaspiCam::RaspiCam()'
simpletest_raspicam.cpp:(.text+0x48): undefined reference to `raspicam::RaspiCam::open(bool)'
simpletest_raspicam.cpp:(.text+0xb0): undefined reference to `raspicam::RaspiCam::grab()'
simpletest_raspicam.cpp:(.text+0xc0): undefined reference to `raspicam::RaspiCam::getImageTypeSize(raspicam::RASPICAM_FORMAT) const'
simpletest_raspicam.cpp:(.text+0xe8): undefined reference to `raspicam::RaspiCam::retrieve(unsigned char*, raspicam::RASPICAM_FORMAT)'
simpletest_raspicam.cpp:(.text+0x120): undefined reference to `raspicam::RaspiCam::getWidth() const'
simpletest_raspicam.cpp:(.text+0x154): undefined reference to `raspicam::RaspiCam::getHeight() const'
simpletest_raspicam.cpp:(.text+0x184): undefined reference to `raspicam::RaspiCam::getImageTypeSize(raspicam::RASPICAM_FORMAT) const'
simpletest_raspicam.cpp:(.text+0x1dc): undefined reference to `raspicam::RaspiCam::~RaspiCam()'
simpletest_raspicam.cpp:(.text+0x208): undefined reference to `raspicam::RaspiCam::~RaspiCam()'

Does anyone have the same problem? Any ideas on how to fix it?

2 Answers 2


you're supposed to download raspicam library source to your raspi and compile it using:

tar xvzf raspicamxx.tgz
cd raspicamxx
mkdir build
cd build
cmake ..

sudo make install
sudo ldconfig

before you'll be able to compile other programs.

  • I have downloaded the raspicam-0.1.1.zip file from the [sourceforge.net/projects/raspicam/files/] SourceForge. Installed it using the commands you mentioned. Instead I used cd raspicam-0.1.1 for second line. May 10, 2014 at 2:00
  • i would try to download raspicam-0.0.5.tgz (71.3 kB) first, then proceed to the latest version.
    – lenik
    May 10, 2014 at 3:11
  • It worked... just had to install .5, .7, and 1.1 in that order for it to work May 13, 2014 at 16:56
  • @lenik Do you have to install 2 versions 1 after another? SO you run the series of command you specified twice once with 0.0.5 and once with latest? COuld you elaborate on your comment.
    – Lightsout
    Oct 17, 2018 at 0:28

The Problem ist: Cmake dont made the raspicam_still lib, only the raspicam lib. An if you dont work every day with cmake, you cannot configure it, cmake is crazy.

At this time you cannot use raspicam still for photos, only raspycam for Video.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.