# How to use raspicam with Visual Studio 2017 and C/C++

In Visual Studio 2017 I created a new project using the cross-platform linux Blink (Raspberry) template. This compiles and runs perfectly and the debugger in the Debug->Linux Console also works pretty well so far.

Since I also need to use the Camera Board V2 for my project I need to include the raspicam API.

For this I created a folder and unzipped the raspicam-0.1.6.zip (https://sourceforge.net/projects/raspicam/) to this folder.

Under Project->Properties->VC++ Directories->Include Directories I added the folder which contains raspicam.h. In my case:

D:\VC2017\Linux\raspicam


in main.cpp I inserted

#include <raspicam.h>


after the first line.

The program no longer compiles and I get the following error:

1>/home/pi/projects/testraspicam/main.cpp:2:22: fatal error: raspicam.h: No such file or directory
1> #include <raspicam.h>
1>                      ^
1>compilation terminated.


I realize that this refers to the folder in the pi, but how and where do I instruct VS to copy all the necessary raspicam include files? I tried manually copying the files to the pi and got a little further, but the more I dabbled, the more errors I got.

Both linux and the pi are totally new to me but I now seem to have come to a dead end and would really appreciate a little help. I find that being able to compile and debug a linux c/c++ program for the raspberry from Visual Studio really cool and don't want to give up yet.

I'm using Visual Studio Community 2017 with Windows 10 64-bit. My Raspberry is a Pi 3 type B with the following version info:

pi@raspberrypi:~ $lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie pi@raspberrypi:~$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@raspberrypi:~ \$ uname -a
Linux raspberrypi 4.4.34-v7+ #930 SMP Wed Nov 23 15:20:41 GMT 2016 armv7l GNU/Linux


Any help would be very much appreciated. Thank you.

Hey I know I am a little late, means it will look for that file on the raspberry in the lib folder.

set the folder to Linux folders (\vc\include, \vc\lib)

now actually getting pas the linking stage is still a challenge for me keep getting cant find -l*... but what I have told you should be the correct place.

raspicam

to

(don't forget "sudo ldconfig" after the installation of raspicam ;o) )

I had the same problem but found a different fix than Precious Roy.

I ended up compiling and installing Raspicam on the Pi board before trying to compile anything on the Visual studio.

Once you do that, then the library files are there and the project can link. All you have to do now is to go (as Sam mentions):

Right click on the project->Properties

For "Library Dependencies" put in raspicam
Once you do this, as Sam mentions, I also ran into a problem where (this is probably known to Linux developers), you have to specify raspicam as the library input, and not libraspicam.a which was my first reaction. (I don't know how you would link something without 'lib' in the name, and hey, why not denormalize everything?)