[英]VSCode C++ Terminal Process terminated with exit code: 1
I want to use VSCode to do basic data sorting in C++, and needed to include a new library;我想用VSCode在C++中做基本的数据排序,需要包含一个新的库; while doing so, I think I accidentally screwed up something serious in the background (probably one of the.json files), because every time I try to build even the most basic programs with g++ through MinGW, I get the message "The terminal process terminated with exit code: 1. Even a basic "Hello World" project that I know works and previously made into an.exe, won't compile into an executable anymore. helloworld.cpp
这样做时,我想我不小心在后台搞砸了一些严重的事情(可能是.json 文件之一),因为每次我尝试通过 MinGW 使用 g++ 构建最基本的程序时,我都会收到消息“终端进程以退出代码终止: 1. 即使是我知道的一个基本的“Hello World”项目,并且之前制作成 an.exe,也不会再编译成可执行文件了。helloworld.cpp
#include <iostream> #include <vector> #include <string> using namespace std; int main() { std::cout <<"Hello World;\n"; }
I tried restarting the window, reinstalling VSCode, starting a new project in a different directory, using the default json files in case I changed something I shouldn't have... I'm used to doing similar data tasks in FORTRAN through gfortran and Python with Spyder through Anaconda, but I'm inexperienced with both C++ and VSCode and am growing frustrated with the level of complexity to do something as simple as make a program run.我尝试重新启动 window,重新安装 VSCode,在不同的目录中启动一个新项目,使用默认的 json 文件,以防我更改了我不应该更改的内容...... Python 和 Spyder 到 Anaconda,但我对 C++ 和 VSCode 都没有经验,并且对运行程序的复杂性越来越感到沮丧。
Any advice on how to fix this would be helpful;有关如何解决此问题的任何建议都会有所帮助; I've checked other similar questions, and no suggestion has worked.
我检查了其他类似的问题,但没有任何建议有效。
Tasks.json任务.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "D:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
c_cpp_properties.json c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
launch.json发射.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": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/helloworld.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
}
]
} }
I want to use VSCode to do basic data sorting in C++, and needed to include a new library;我想用VSCode在C++中做基本的数据排序,需要包含一个新的库; while doing so, I think I accidentally screwed up something serious in the background (probably one of the.json files), because every time I try to build even the most basic programs with g++ through MinGW, I get the message "The terminal process terminated with exit code: 1. Even a basic "Hello World" project that I know works and previously made into an.exe, won't compile into an executable anymore. helloworld.cpp
这样做时,我想我不小心在后台搞砸了一些严重的事情(可能是.json文件之一),因为每次我尝试通过MinGW使用g++构建最基本的程序时,我都会收到消息“终端进程以退出代码终止: 1. 即使是我知道的一个基本的“Hello World”项目,并且之前制作成 an.exe,也不会再编译成可执行文件了。helloworld.cpp
#include <iostream> #include <vector> #include <string> using namespace std; int main() { std::cout <<"Hello World;\n"; }
I tried restarting the window, reinstalling VSCode, starting a new project in a different directory, using the default json files in case I changed something I shouldn't have... I'm used to doing similar data tasks in FORTRAN through gfortran and Python with Spyder through Anaconda, but I'm inexperienced with both C++ and VSCode and am growing frustrated with the level of complexity to do something as simple as make a program run.我尝试重新启动 window,重新安装 VSCode,在不同的目录中启动一个新项目,使用默认的 json 文件,以防我更改了我不应该更改的内容...... Python 与 Spyder 到 Anaconda,但我对 C++ 和 VSCode 都没有经验,并且对运行程序的复杂性越来越感到沮丧。
Any advice on how to fix this would be helpful;有关如何解决此问题的任何建议都会有所帮助; I've checked other similar questions, and no suggestion has worked.
我检查了其他类似的问题,但没有任何建议有效。
Tasks.json任务.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "D:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
c_cpp_properties.json c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
launch.json发射.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": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/helloworld.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
}
]
} }
I was gone with same problem in case the exit code terminated with -1 as spend 2 hour then find that there is error in code as when I click on error button there is no error as I not get output as expected after seeing program so many I found that minor mistake in my program increase the complexity so I suggest check each line of code file carefully,in my case problem is solved by doing correction in code.如果退出代码以 -1 终止,因为花费 2 小时然后发现代码中有错误,因为当我单击错误按钮时没有错误,因为我没有得到 output 看到程序这么多后,我没有得到同样的问题我发现我的程序中的小错误增加了复杂性,所以我建议仔细检查每一行代码文件,在我的情况下,问题是通过对代码进行更正来解决的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.