Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/164.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VS代码正在忽略c++;调试 我在VS代码中调试C++代码,但它不在断点上停止,可视化变量,监视和调用堆栈,这是它应该做的。而不是在调试控制台中打印: Breakpoint 1, 0x000000000040074a in main () [Inferior 1 (process 9445) exited normally] The program '/home/hashir/x/a.out' has exited with code 0 (0x00000000)_C++_Visual Studio Code_Visual Studio Debugging - Fatal编程技术网

VS代码正在忽略c++;调试 我在VS代码中调试C++代码,但它不在断点上停止,可视化变量,监视和调用堆栈,这是它应该做的。而不是在调试控制台中打印: Breakpoint 1, 0x000000000040074a in main () [Inferior 1 (process 9445) exited normally] The program '/home/hashir/x/a.out' has exited with code 0 (0x00000000)

VS代码正在忽略c++;调试 我在VS代码中调试C++代码,但它不在断点上停止,可视化变量,监视和调用堆栈,这是它应该做的。而不是在调试控制台中打印: Breakpoint 1, 0x000000000040074a in main () [Inferior 1 (process 9445) exited normally] The program '/home/hashir/x/a.out' has exited with code 0 (0x00000000),c++,visual-studio-code,visual-studio-debugging,C++,Visual Studio Code,Visual Studio Debugging,下面是launch.json文件: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "

下面是launch.json文件:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/hashir/x/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "/home/hashir/x/",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

使用
-g
标记和g++/clang++

将程序混合在一起,我发现如果源代码文件名包含空格,如“Binary Search.cpp”,VSCode将忽略断点,而不管“stop at entry”配置如何。虽然源文件的路径中包含空格,但从源文件名称中删除空格仍然有效。例如,“C++练习/BinarySearch.cpp”似乎是有效的


在GitHub上公开的问题中,有人建议非ascii字符可能会导致此类问题。

这个问题简直毁了我的一天。事实证明,我所要做的就是运行构建任务,然后开始调试。

或者
Ctrl+Shift
+
B
,然后开始调试。

“stopAtEntry”:false
应该是
“stopAtEntry”:true
?谢谢,我也面临同样的问题。你的回答对我很有帮助。有没有特别说明在哪里输入这个标签?谢谢。@andreyb在编译时添加该标志,如在运行g++file.cpp命令时。