Share launch.json visual studio code c++,

tinyrabbit357

New member
#Launch.Json, #Visual Studio Code, #C ++, #C ++ Debugging, #Visual Studio Code Debugging

Launch.json là một tệp cấu hình cho Visual Studio Code cách gỡ lỗi chương trình C ++.Nó có thể được sử dụng để chỉ định trình biên dịch, trình gỡ lỗi và các đối số chương trình.

Để tạo tệp Launch.json, hãy mở bảng lệnh (Ctrl+Shift+P) và gõ "Debug: Open Launch.json".Điều này sẽ tạo một tệp Launch.json mới trong thư mục gốc của dự án của bạn.

Sau đây là một ví dụ về tệp Launch.json để gỡ lỗi chương trình C ++:

`` `
{
"Phiên bản": "0.2.0",
"Cấu hình": [
{
"Tên": "C ++ (GDB)",
"Loại": "CPPDBG",
"Yêu cầu": "Khởi chạy",
"Chương trình": "$ {WorkSpaceFolder} /main.exe",
"Args": ["--gtest_filter = foo"],
"Stopatentry": sai,
"CWD": "$ {WorkSpaceFolder}",
"môi trường": [],
"ExternalConsole": Sai,
"Mimode": "GDB",
"SetupCommands": [
{
"Text": "-enable-pretty in",
"Bỏ qua": Đúng
}
]
}
]
}
`` `

Tệp cấu hình này yêu cầu mã Visual Studio sử dụng trình gỡ lỗi C ++ (CPPDBG) để khởi chạy chương trình main.exe.Chương trình sẽ được ra mắt trong thư mục làm việc hiện tại ("$ {WorkspaceFolder}") và trình gỡ lỗi sẽ dừng ở dòng mã đầu tiên.

Để biết thêm thông tin về cách sử dụng Launch.json, hãy xem [Tài liệu mã Visual Studio] (Debugging in Visual Studio Code).

### 5 hashtag cho bài viết này

* #Launch.Json
* #Visual Studio Code
* #C ++
* #C ++ gỡ lỗi
* #Visual Code Code Debugging
=======================================
#Launch.Json, #Visual Studio Code, #C++, #C++ debugging, #Visual Studio Code debugging ## Launch.json for C++ debugging in Visual Studio Code

Launch.json is a configuration file that tells Visual Studio Code how to debug a C++ program. It can be used to specify the compiler, the debugger, and the program arguments.

To create a Launch.json file, open the Command Palette (Ctrl+Shift+P) and type "Debug: Open launch.json". This will create a new Launch.json file in the root directory of your project.

The following is an example of a Launch.json file for debugging a C++ program:

```
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ (GDB)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/main.exe",
"args": ["--gtest_filter=foo"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
```

This configuration file tells Visual Studio Code to use the C++ debugger (cppdbg) to launch the program main.exe. The program will be launched in the current working directory ("${workspaceFolder}") and the debugger will stop at the first line of code.

For more information on how to use Launch.json, see the [Visual Studio Code documentation](https://code.visualstudio.com/docs/editor/debugging#_launchjson).

### 5 hashtags for this article

* #Launch.Json
* #Visual Studio Code
* #C++
* #C++ debugging
* #Visual Studio Code debugging
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top