# C++ interface¶

This page explains how to create a CMake based C++ project using the Open3D C++ interface.

Note

For help on the C++ interfaces, refer to examples in [src/Test] and [src/Tools] folder and check Doxygen document for C++ API.

## Install open3d from source¶

For installing from source see Compiling from source.

## Create C++ project¶

Warning

The following is supported at this time only on Ubuntu with all dependencies installed.

Let’s create a basic C++ project based on CMake and Open3D installed libraries and headers.

1. Get the code from TestVisualizer.cpp
2. Get the CMake config file from CMakeLists.txt
3. Build the project using the following commands:
mkdir -p build
cd build
cmake ..
make -j


### Highlights¶

The following fragment from CMakeLists.txt shows how to specify hints to CMake when looking for the Open3D installation. This technique is required when installing Open3D to a user location rather than to a system wide location.

 9 find_package(Open3D QUIET HINTS "~/open3d_install/lib/CMake") 

This section of the CMakeLists.txt specifies the installed Open3D include directories, libraries and library directories.

 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 # Open3D if (Open3D_FOUND) message(STATUS "Found Open3D ${Open3D_VERSION}") add_executable(TestVisualizer TestVisualizer.cpp) include_directories(${Open3D_INCLUDE_DIRS}) link_directories(${Open3D_LIBRARY_DIRS}) set_target_properties(TestVisualizer PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") target_link_libraries(TestVisualizer \${Open3D_LIBRARIES}) target_link_libraries(TestVisualizer tinyfiledialogs) else () message(SEND_ERROR "Open3D not found") endif ()