I've c++ cmake project beginning-cpp20.

The project structure as as below -

$ tree .
├── CMakeLists.txt
├── launch.json
└── meetingcpp.cpp

The contents of CMakeLists.txt is -

cmake_minimum_required(VERSION 3.20)


add_executable(meetingcpp meetingcpp.cpp)

The launch.json is -

    "version": "0.2.0",
    "configurations": [
            "name": "Debug Emacs",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/meetingcpp",
            "args": [],
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb"

The meetingcpp.cpp is -


int main() {
    auto x = 66;
    auto y = 14;
    auto a= x + y;
    std::cout << ++y + x + x << std::endl;
    std::cout << a;

I compiled the program using command g++ -o meetingcpp meetingcpp.cpp. Here is my ls output -

enter image description here

When I right click the file and choose Debug -

enter image description here

In the Debug template I choose Debug Emacs then I get the below error -

enter image description here

What is the issue here? How can I fix this issue?

  • Did you compiled the program? i.e in your files tree there should be a forth item named meetingcpp.
    – Ian
    Jul 1, 2022 at 11:43
  • Yes. I compiled the program using command g++ -o meetingcpp meetingcpp.cpp and then I started debugging Jul 1, 2022 at 19:49
  • For sure the message containing vfork is due to missing the debug server configuration and initialisation. See this page emacs-lsp.github.io/dap-mode/page/configuration/… to choose what to select and install, according to your needs. You should take into account there are also some other problems with your posted configuration - i.e you must decide what you intend to do/use in your project(s) - CMake/Make and what tools: gdb/clang.
    – Ian
    Jul 2, 2022 at 13:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.