简体   繁体   中英

Visual Studio Code VSCode Debugging/Compile C++

I have some questions to debug and compile in VSCode for C++ .

I have installed the c/c++ addon from Microsoft. After this, I started Debugging and chose c++ (Windows) as debugging mode. Which program I have to choose for this line in the launch.json file?

"program": "enter program name, for example ${workspaceRoot}/a.exe"

The next problem is how to configure the C++ compiler to compile out of Visual Studio Code.

Looks to me like it is asking you to choose the name for your executable - you need to choose a name. I am not familiar with VSCode. In VStudio, you would right-click on the project, select properties and under the linker it would be the field for the output file.

You'll need to find the relative path to whichever program you'd like to debug let's call the executable, "example.exe" that's located in /exampleProj/debug/ relative to your workspace root which is whichever folder you opened to start VS Code(if you're not sure where it is go back to the navigate sidebar and locate the file from there).

you'll then want your progam entry as follows:

"program": "${workspaceRoot}/exampleProj/debug/example.exe"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM