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 -
When I right click the file and choose Debug -
In the Debug template I choose Debug Emacs
then I get the below error -
What is the issue here? How can I fix this issue?
meetingcpp
.g++ -o meetingcpp meetingcpp.cpp
and then I started debuggingvfork
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.