0

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)

project(BEGINING_CPP VERSION 1.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

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": [],
            "cwd":"${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb"
        }
    ]
}

The meetingcpp.cpp is -

#import<iostream>

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 01 '22 at 11:43
  • Yes. I compiled the program using command `g++ -o meetingcpp meetingcpp.cpp` and then I started debugging – Rajkumar Natarajan Jul 01 '22 at 19:49
  • For sure the message containing ```vfork``` is due to missing the debug server configuration and initialisation. See this page https://emacs-lsp.github.io/dap-mode/page/configuration/#native-debug-gdblldb 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 02 '22 at 13:40

0 Answers0