# Changed version of ORB_SLAM3 for Windows 10. Project is provided with already built ORB_SLAM3.lib library. You might want to skip the build part and put the library from `lib/ORB_SLAM3.lib` to `build/Release/ORB_SLAM3.lib` ## Prerequisites - OpenCV3 (Not from Anaconda): https://opencv.org/releases/ - Boost (You need to build it): https://www.boost.org/users/download/ - Eigen3. You can install it using vcpkg ### Note on Preferences of projects in Visual Studio 2019 1. You may need to change the Runtime Library of the project frequently. In order to do that, you need to open Preferences -> C/C++ -> Code Generation -> Runtime Library -> MT. Further the procedure above will be mentioned just as "Change the Runtime Library to MT" 2. You may also need to change a lot of the libraries to Static. In order to do that, you need to: General -> Configuration Type -> Static lib (.lib). And in Advanced -> Target File Extension -> .lib Further this procedure will be mentioned as "Change the project to Static" 3. All of the commands must be executed in the Windows cmd. ## Build Boost 1. `bootstrap.bat` 2. `.\b2 toolset=msvc-14.2 runtime-link=static` ## Build DBoW2 1. `mkdir build && cd build` 2. `cmake ..` 3. Open Visual Studio 16 2019 with Administrative privilege and open the project 4. Change the Runtiime Library to MT 5. Change the project to Static 6. Build ALL_BUILD ## Build g2o 1. Install Eigen3: `vcpkg install eigen3:x64-windows` 2. `mkdir build && cd build` 3. `cmake -DCMAKE_TOOLCHAIN_FILE=C:/Users/ivan/Source/Repos/ORB_SLAM3/Thirdparty/Pangolin/vcpkg/scripts/buildsystems/vcpkg.cmake ..` Instead of my path, you have to paste your path to `vcpkg.cmake`. Or you may download and configure Eigen3 with CMake. No need to to build. You will just need to include the path to Eigen3. 4. Open Visual Studio 16 2019 with Administrative privilege and open the project 5. Change the Runtiime Library to MT 6. Change the project to Static 7. Build ALL_BUILD ## Build Pangolin 1. `mkdir build && cd build` 2. `cmake ..` 3. Open Visual Studio 16 2019 with Administrative (IMPORTANT!) privilege and open the project 4. Follow this fix: https://github.com/stevenlovegrove/Pangolin/issues/609#issuecomment-645653656 5. Change the project to Static 6. Build project pangolin Or: open https://github.com/stevenlovegrove/Pangolin official repo and install it from `master` branch. Follow respective README.md file for installation. ## Build ORB_SLAM3 1. `mkdir build && cd build` 2. `cmake ..` 3. Open Visual Studio 16 2019 with Administrative (IMPORTANT!) privilege and open the project 4. Change the Runtiime Library to MT 5. Change the project to Static 6. ~~Add the path to vcpkg include: C/C++ -> Additional Include Libraries -> C:\Users\ivan\Source\Repos\ORB_SLAM3\Thirdparty\Pangolin\vcpkg\installed\x64-windows\include~~ If vcpkg is installed, the path to Eigen3 will be automatically added to MSVC. 7. ~~You might need to add path to Boost libs manually to Libraian → General → Additional Library Dependencies: C:\Users\ivan\Source\Repos\ORB-SLAM3forWindows\Thirdparty\boost_1_77_0\stage\lib~~ Automatic boost finding included into the version 1.0 8. Install vcpkg via https://vcpkg.io/en/getting-started.html and integrate it. Install openssl through vcpkg: "vcpkg install openssl:x64-windows" 8. Build ORB_SLAM3 project, use C++17 standard. 9. Note: if the build is unseccessfull, but there's no Errors, try to reload Visual Studuio and build the project again. # ----- Log. ----- ## Попытка забилдить Pangolin and g2o: 1. Включены права андминистратора 2. Ошибка [undefined reference to `vasprintf' · Issue #1954 · esp8266/Arduino (github.com)](https://github.com/esp8266/Arduino/issues/1954) . Фикс и билд библиотеки .dll сработал. ## После успешного билда Pangolin, g2o and DBoW2 пробуем билд ORB_SLAM3: 1. Ошибка undefined usleep: определите функцию [c++, usleep() is obsolete, workarounds for Windows/MingW? - Stack Overflow](https://stackoverflow.com/questions/5801813/c-usleep-is-obsolete-workarounds-for-windows-mingw/17283549) 2. Установите vcpkg и включите его vcpkg integrate install 3. Ошибка с OpenCV из Anaconda: попытка переключить на OpenCV3 (c VC15) 4. Ошибка cannot open include file openssl/md5.h нужно отдельно прописывать в инклуде CMake? Попытка: ручная прописка в Additional Include Directories 5. Добавлены изменения в ORB_SLAM3 в код [MapPoint.cc](http://MapPoint.cc), пожалуйста, используйте мой исправленный код для билда 6. Namespace changed from std::tr1 to std. 7. Test: Linker → Additional Include Directories C:\Users\ivan\Source\Repos\ORB_SLAM3\build; C:\Users\ivan\Source\Repos\ORB_SLAM3\build\Release 8. Автоматическое появление Release\ORB_SLAM3.lib ??????? 9. Определение usleep в [System.cc](http://System.cc) и System.hpp 10. Также, обратите внимание на эту ссылку, также по этой ссылке вы найдёте репозиторий, который во многом похож на мои изменения к ORB_SLAM3 для Windows. https://github.com/UZ-SLAMLab/ORB_SLAM3/pull/53 11. Last Change: mnFullBAIdx++; substituted with mnFullBAIdx = true; in LoopClosing.cc ## Чек-лист по изменениям в проект в Visual Studio 2019 для билда: 1. Runtime Library: MT 2. Static Library 3. Add (path to vcpkg) manually to Additional Include Directories C:\Users\ivan\Source\Repos\ORB_SLAM3\Thirdparty\Pangolin\vcpkg\installed\x64-windows\include 4. Add path to Boost libs manually to Linker → General → Additional Library Dependencies: C:\Users\ivan\Source\Repos\ORB-SLAM3forWindows\Thirdparty\boost_1_77_0\stage\lib 5. From Linker → Input → Additional Dependencies delete Release\oscpack.lib