Setting up for gazebo plugin development and debugging

Hi,

I’m currently developing a new gazebo plugin for SITL and I was wondering how correctly setup vscode for development and debugging. It seems like function linked IntelliSense, such as reference lookup and autocomplete, don’t fully work for the code in the sitl_gazebo folder.

I’ve tried open a new vscode window directly in the sitl_gazebo but cmake fails to configure the folder.


[variant] Loaded new set of variants
[kit] Successfully loaded 6 kits from /home/borowczyk-alex/.local/share/CMakeTools/cmake-tools-kits.json
[proc] Executing command: /usr/bin/cmake --version
[proc] Executing command: /usr/bin/clang -v
[main] Configuring project: sitl_gazebo 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo -B/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- install-prefix: /usr
[cmake] -- cmake build type: Debug
[cmake] -- The C compiler identification is Clang 10.0.0
[cmake] -- The CXX compiler identification is Clang 10.0.0
[cmake] -- Check for working C compiler: /usr/bin/clang
[cmake] -- Check for working C compiler: /usr/bin/clang -- works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Check for working CXX compiler: /usr/bin/clang++
[cmake] -- Check for working CXX compiler: /usr/bin/clang++ -- works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX17
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX17 - Success
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX14
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX14 - Success
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX11
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX0X
[cmake] -- Performing Test COMPILER_SUPPORTS_CXX0X - Success
[cmake] -- Using C++17 standard
[cmake] -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.58") found components: system thread filesystem 
[cmake] -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
[cmake] -- Checking for module 'bullet>=2.82'
[cmake] --   Found bullet, version 2.88
[cmake] -- Found ccd: /usr/include (found suitable version "2.0", minimum required is "2.0") 
[cmake] -- Found fcl: /usr/include (found suitable version "0.5.0", minimum required is "0.3.2") 
[cmake] -- Found assimp: /usr/include (found version "5.0.0") 
[cmake] -- Found DART: /usr/include (Required is at least version "6.6") found components: dart 
[cmake] -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version "1.71.0", minimum required is "1.40.0") found components: thread system filesystem program_options regex iostreams date_time 
[cmake] -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") 
[cmake] -- Looking for ignition-math6 -- found version 6.13.0
[cmake] -- Searching for dependencies of ignition-math6
[cmake] -- Looking for OGRE...
[cmake] -- OGRE_PREFIX_WATCH changed.
[cmake] -- Checking for module 'OGRE'
[cmake] --   Found OGRE, version 1.9.0
[cmake] -- Found Ogre Ghadamon (1.9.0)
[cmake] -- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so
[cmake] -- Looking for OGRE_Paging...
[cmake] -- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so
[cmake] -- Looking for OGRE_Terrain...
[cmake] -- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so
[cmake] -- Looking for OGRE_Property...
[cmake] -- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so
[cmake] -- Looking for OGRE_RTShaderSystem...
[cmake] -- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so
[cmake] -- Looking for OGRE_Volume...
[cmake] -- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so
[cmake] -- Looking for OGRE_Overlay...
[cmake] -- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so
[cmake] -- Looking for ignition-math6 -- found version 6.13.0
[cmake] -- Looking for ignition-transport8 -- found version 8.4.0
[cmake] -- Searching for dependencies of ignition-transport8
[cmake] -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found suitable version "3.6.1", minimum required is "3") 
[cmake] -- Config-file not installed for ZeroMQ -- checking for pkg-config
[cmake] -- Checking for module 'libzmq >= 4'
[cmake] --   Found libzmq , version 4.3.2
[cmake] -- Found ZeroMQ: TRUE (Required is at least version "4") 
[cmake] -- Checking for module 'uuid'
[cmake] --   Found uuid, version 2.34.0
[cmake] -- Found UUID: TRUE  
[cmake] -- Looking for ignition-msgs5 -- found version 5.11.0
[cmake] -- Searching for dependencies of ignition-msgs5
[cmake] -- Looking for ignition-math6 -- found version 6.13.0
[cmake] -- Checking for module 'tinyxml2'
[cmake] --   Found tinyxml2, version 6.2.0
[cmake] -- Looking for ignition-msgs5 -- found version 5.11.0
[cmake] -- Looking for ignition-common3 -- found version 3.15.1
[cmake] -- Searching for dependencies of ignition-common3
[cmake] -- Looking for dlfcn.h - found
[cmake] -- Looking for libdl - found
[cmake] -- Found DL: TRUE  
[cmake] -- Searching for <ignition-common3> component [graphics]
[cmake] -- Looking for ignition-common3-graphics -- found version 3.15.1
[cmake] -- Searching for dependencies of ignition-common3-graphics
[cmake] -- Looking for ignition-math6 -- found version 6.13.0
[cmake] -- Looking for ignition-fuel_tools4 -- found version 4.8.0
[cmake] -- Searching for dependencies of ignition-fuel_tools4
[cmake] -- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.68.0")  
[cmake] -- Checking for module 'jsoncpp'
[cmake] --   Found jsoncpp, version 1.7.4
[cmake] -- Found JSONCPP: TRUE  
[cmake] -- Checking for module 'yaml-0.1'
[cmake] --   Found yaml-0.1, version 0.2.2
[cmake] -- Found YAML: TRUE  
[cmake] -- Checking for module 'libzip'
[cmake] --   Found libzip, version 1.5.1
[cmake] -- Found ZIP: TRUE  
[cmake] -- Looking for ignition-common3 -- found version 3.15.1
[cmake] -- Looking for ignition-math6 -- found version 6.13.0
[cmake] -- Looking for ignition-msgs5 -- found version 5.11.0
[cmake] -- Checking for one of the modules 'glib-2.0'
[cmake] -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") 
[cmake] -- Found OpenCV: /usr (found version "4.2.0") 
[cmake] -- Found TinyXML: /usr/lib/x86_64-linux-gnu/libtinyxml.so  
[cmake] -- Checking for module 'gstreamer-1.0 >= 1.0'
[cmake] --   Found gstreamer-1.0 , version 1.16.3
[cmake] -- Checking for module 'gstreamer-base-1.0 >= 1.0'
[cmake] --   Found gstreamer-base-1.0 , version 1.16.3
[cmake] -- Checking for module 'gstreamer-app-1.0 >= 1.0'
[cmake] --   Found gstreamer-app-1.0 , version 1.16.3
[cmake] -- Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES (Required is at least version "1.0") 
[cmake] -- Checking for module 'OGRE'
[cmake] --   Found OGRE, version 1.9.0
[cmake] -- Building klt_feature_tracker without catkin
[cmake] -- Building OpticalFlow with OpenCV
[cmake] -- Could NOT find MAVLink (missing: MAVLINK_INCLUDE_DIRS) (found version "2.0")
[cmake] -- catkin DISABLED
[cmake] -- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1") 
[cmake] -- Checking for module 'protobuf'
[cmake] --   Found protobuf, version 3.6.1
[cmake] -- Gazebo version: 11.12
[cmake] -- Found GStreamer: adding gst_camera_plugin
[cmake] -- Found GStreamer: adding gst_video_stream_widget
[cmake] CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
[cmake] Please set them or make sure they are set and tested correctly in the CMake files:
[cmake] _MAVLINK_INCLUDE_DIR
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake]    used as include directory in directory /home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/unit_tests
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build/CMakeFiles/CMakeError.log".
[proc] The command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo -B/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build -G Ninja exited with code: 1
[main] Configuring project: sitl_gazebo 
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo -B/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error: Error: generator : Ninja
[cmake] Does not match the generator used previously: Unix Makefiles
[cmake] Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
[proc] The command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -S/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo -B/home/borowczyk-alex/src/px4_firmware/Tools/sitl_gazebo/build -G Ninja exited with code: 1