Items with no label
3335 Discussions

Set up a C++ project in VS2017 from scratch

JAlli3
Novice
1,660 Views

Hi, as the title says, I'm trying to set up a project in from scratch without success. I've downloaded the latest SDK from GitHub and can get the examples running no problem. I'm using a C++ toolkit called openFrameworks and need to integrate the SDK into an existing project. 

 

So far I've added librealsense-2.18.1\include\librealsense2 to the C/C++ -> Additional Included Directories and pointed to librealsense-2.18.1\Build\Release in the Linker -> Additional Library Directories to connect to the realsense2.lib file.

 

I've tried some of the code from this page - https://github.com/IntelRealSense/librealsense/tree/master/examples/capture

 

But pipe.start(); leads to lots of unresolved external symbol errors e.g:

 

Error - LNK2001 - unresolved external symbol _rs2_get_failed_function - ofxIntelRealSense.obj

 

What do I have to link to in order to get started? All I need to do is get the depth texture from 2 cameras. 

 

Details:

Windows 10 with VS2017

RealSense D435 with latest firmware

SDK 2.18.1 downloaded from GitHub

0 Kudos
1 Solution
JAlli3
Novice
1,046 Views

Thanks for your reply. It seems like the only thing I was missing was the following in my RealSense class:

 

#pragma comment(lib, "realsense2.lib")

 

Not sure why this is necessary. I thought that linking to the correct directory was enough.

View solution in original post

0 Kudos
4 Replies
MartyG
Honored Contributor III
1,046 Views

This is a subject that admittedly is not explained in a beginner-friendly way. I should mention that I do not usually do project building in Visual Studio (the Unity game engine is my primary development environment), but I will do my best to assist.

 

I believe that in RealSense SDK 2.0, Librealsense is linked in to a Visual Studio project via a program called CMake. The links below may be helpful in understanding this process.

 

https://github.com/zivsha/librealsense/tree/getting_started_example/examples/getting-started

 

https://github.com/IntelRealSense/librealsense/issues/2471

0 Kudos
JAlli3
Novice
1,047 Views

Thanks for your reply. It seems like the only thing I was missing was the following in my RealSense class:

 

#pragma comment(lib, "realsense2.lib")

 

Not sure why this is necessary. I thought that linking to the correct directory was enough.

0 Kudos
MartyG
Honored Contributor III
1,046 Views

Is your project linking to the RealSense library correctly now, please?

0 Kudos
JAlli3
Novice
1,046 Views

Yes it is. See my above post for the solution. Thanks again, I appreciate your response.

0 Kudos
Reply