C++-latest data structures and algorithms using only standard libraries. This answers many of the challenges in HackerRank, LeetCode and some in Codility. > 1000 Google Test cases and counting.
- Download the header files from https://github.com/brt-v/pcg-cpp
- Put all the
.hppintosrc/folder
- Use Visual Studio 2022, latest Windows SDK and ISO C++26 Standard.
- Download googletest from https://github.com/google/googletest/releases and extract to C:\Projects\C++\googletest
- Intel oneAPI toolkits: https://www.intel.com/content/www/us/en/docs/onetbb/get-started-guide/2022-2/overview.html
- Run
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
- Download GoogleTest source code from https://github.com/google/googletest/releases
- Open the project folder using VS and generate CMake cache, click “Build All” and it will generate lib files.
- Create a Google Test project, manage nuget packages and uninstall the package Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn
- Set the property page
C/C++ > General > Additional Include Directories: adds the googletest/include and googlemock/include paths. Linker > General > Additional Library Directories: point to the path of the compiled .lib file (e.g. googletest-1.17.0\out\build\x64-debug\lib). Linker > Input > Additional Dependencies: adds gtest.lib and gtest_main.lib. C/C++ > Code Generation > Run Library: match the compilation configuration of the Googletest libraries (e.g. MTd for Debug mode) (5) Then the Google Test project can be built successfully.
- Use vcpkg to download (Note: Currently in vcpkg, gtest version is 1.14.0)
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
vcpkg integrate install
vcpkg.exe install gtest:x64-windows
Use ‘vcpkg list’ to view installed Google Test versions
Create a Google Test project, manage nuget packages and uninstall the package Microsoft.googletest.v140.windesktop.msvcstl.static.rt-dyn and then build it.
-
Visual Studio Code with the following extensions:
- C/C++
- CMake Tools extension for VS Code (https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/how-to.md)
- https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter
-
To convert Visual Studio solution
.slnand included.vcxprojtoCMakeLists.txt:- https://github.com/pavelliavonau/cmakeconverter
cmake-converter -s DataStructuresAlgorithms.sln
-
Install the following packages on Ubuntu:
- build-essential
- gdb
- g++-latest (https://code.visualstudio.com/docs/cpp/cmake-linux)
- libtbb-dev (Intel® Threading Building Blocks)
- libgtest-dev
- ninja-build
- Intel oneAPI toolkits: https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux
- Add the following to
/etc/profile:
[ -f "/opt/intel/oneapi/setvars.sh" ] && . /opt/intel/oneapi/setvars.sh -
Download googletest from https://github.com/google/googletest/releases and extract to /usr/src/googletest
- Press
CTRL + SHFT + P, typeCMAKE: Select Variantto choose the target build type. For example, "Debug" or "Release". - Press
CTRL + SHFT + Band select one of the options
- Press
CTRL + F5
- Press
SHIFT + F5