Compilation Error: rs-align example on VS2017
| Required Info | |
|---|---|
| Camera Model | D400 |
| Firmware Version | 05.09.02.00 |
| Operating System & Version | Win 10 |
| Kernel Version (Linux Only) | |
| Platform | PC |
| SDK Version | 2.16.1 |
| Language | C++ |
| Segment | others |
Issue Description
Hello once again,
Unfortunately I have ran into errors which I have spent 2 days trying to solve. I have asked this question once before, and @dorodnic has given me guidance but I am still having trouble with it.
Things I have done
- Created new empty C++ Project, copied [example.hpp, int-rs-splash.hpp, stb_easy_font.h, stb_image.h, stb_image_write.h] into File Explorer
- Copied intel.realsense.props in Property Manager
- Copied [imgui.cpp, imgui_draw.cpp, imgui_impl_glfw.cpp] into File Explorer
- VS > Properties > C/C++ > General > Additional Include Dirs > Edit > (C:\Users\efoo1\Desktop\RealSenseCmake\third-party\imgui)
- Created Source.cpp under source and copied the code from rs-align.cpp into it
- VS > Solution Explorer > Source > Add Existing Item > and copied [imgui.cpp, imgui_draw.cpp, imgui_impl_glfw.cpp]
Here is how my Solution Explorer looks:

Errors
- Line 5 has errors, but I figured since I manually copied example.hpp into the project in File Explorer, #include "example.hpp" directly would make more sense.
- Line 25 is a bigger error, it says "no suitable conversion function from "window" to "GLFWwindow*" exists".. I don't get it since this works on CMake.

- If I comment Line 25 out, I still get a magnitude of errors.. on the imgui_impl_glfw.cpp file, not on Source.cpp.

- I tried to add the GLFW library into the Properties Pages and shown below. (I downloaded the GLFW files and placed it on my Desktop)
4.1. Properties > VC++ > Include Directories > (C:\Users\efoo1\Desktop\glfw-3.2.1.bin.WIN64\include)
4.2 Properties > VC++ > Library Directories > (C:\Users\efoo1\Desktop\glfw-3.2.1.bin.WIN64\lib-vc2015)
4.3 Properties > Linker > Input > Additional Dependencies > glfw3.lib & glfw3dll.lib

- Lastly, I copied the glfw3.dll into the Project File Explorer.

Problems still
I am still getting so many errors during linking even after trying so many things...

CMake
NOTE: CMake works, but the problem is I cannot modify on it. Hence, I am trying to create the project from scratch and manually include the directories..
I am losing my sanity.. any help would be 150% appreciated. Thank you guys, you're my last hope
Edit 1: I just found out that on the CMake version of rs-align, the code inside #include "../example.hpp" is quite different from the #include "example.hpp" in the other simpler examples such as rs-align. So a simple copy edit of the #include is not possible...
class window {} is especially different!! :o
Source Code: #include "../example.hpp" #include "example.hpp"
Will change it and see how it goes. Also changed to Solution Platform to x64 since my GLFW library is x64.
Edit 2: Still having linker problems with Source.obj & imgui_impl_glfw.obj files... not sure how to fix this one
Edit 3: Using 32bit binaries of GLFW seem to work, but still testing. Rough steps taken: https://github.com/HippoEug/imgui/blob/master/README.md
[Realsense Customer Engineering Team Comment] Hi @HippoEug,
You can build the all librealsense project and open "RealsenseExamplesAlign.sln". Then, you can apply the similar settings, files and libraries to your rs-align project.
Yeah I have tried that, had errors. But I think I found the fix for it.. but using 32bit binaries. Still gotta figure the x64 one out!
My standalone rs-align project also attached for reference. rs-align-standaloneBuild.zip
Thank you freemanlo, that's very helpful :D
[Realsense Customer Engineering Team Comment] Hi @HippoEug,
Still need any support for this topic?
Note: in the upcoming release the installer is going to include rs-align, post-processing, playback-record and opencv examples based on @HippoEug and others feedback.