DEV Community

mareknovakz
mareknovakz

Posted on

Debugging C/C++ project in VScode

Hello, I can't debugging my project. Especially, I can't find class "PassiveElement.cpp". I don't know, what is wrong.

launch.json


{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++: g++ build and debug active file",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/main", //dont write suffix
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "miDebuggerPath": "/usr/bin/gdb",
      "preLaunchTask": "Open include and source folders"
    }
  ],
  "tasks": [
    {
      "label": "Open include and source folders",
      "type": "shell",
      "command": "code -r ${workspaceFolder}/include ${workspaceFolder}/source",
      "group": "build"
    }
  ]
}

Enter fullscreen mode Exit fullscreen mode

main.cpp

#include <iostream>

int main() {

     std::cout << "SPICE_NOVAK_TEST_VERSION - ZKOUSKA" << std::endl;

    PassiveElement paselem;

    while (true){}//infinity cycle

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

c_cpp_properties.json


{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}/source",
                "${workspaceFolder}/include"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "BartmanAbyss.amiga-debug",
            "forcedInclude": [],
            "browse": {
                "path": [
                    "${workspaceFolder}/include",
                    "${workspaceFolder}/source"
                ],
                "limitSymbolsToIncludedHeaders": true
            }
        }
    ],
    "version": 4
}

Enter fullscreen mode Exit fullscreen mode

Structure project:
Image description

Image description

Image description

Top comments (0)