我正在尝试安装MinGW并检查其在MSVSCode中的调试。
我已经运行MinGW安装管理器(mingw-get)GUI来安装MinGW。我安装了以下内容:
并且我已经验证它可以正常工作,如下:-
C:\MinGW\bin>g++ --version
g++ <MinGW.org GCC-8.2.0-5> 8.2.0
Copyright <c> 2018 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions. There is No warranty; not even for
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
用户变量PATH:-
C:\ProgramData\Oracle\Java\javapath;c:\Program Files(x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLSClient\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\MATLAB\R2016b\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Microsoft VSCode\bin;C:\Users\T\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\T\AppData\Local\Programs\Python\Python37\;C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin;C:\Users\T\AppData\Roaming\npm; C:\MinGW\bin;
系统变量路径:-
C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLSClient\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\MATLAB\R2016b\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Microsoft VS Code\bin; C:\MinGW\bin;
如果输入
C:\Users>gcc -v
我收到错误消息
'gcc' is not recognised as an internal or external command, operable program or batch file.
但是,如果我键入
C:\Users>set PATH=C:\MinGW\bin;%PATH%
然后我写
C:\Users>gcc -v
然后我得到...
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-
pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-5' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads -- with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs -- with-libiconv-prefix=
/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable- build-format-warnings Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-5)
但是,仅在打开此命令控制台窗口的时间内。
我的操作系统是Windows 7 Home Premium Service Pack 1 64位操作系统。
有什么方法可以使它正常工作,这样我就不需要每次都写set PATH了,所以它可以在MSVSCode中工作?
非常感谢任何帮助建议
除非是错字,否则粘贴到问题中的环境变量似乎包含多余的空间:
...C:\Program Files\Microsoft VS Code\bin; C:\MinGW\bin;
^
这使系统搜索(不存在)路径“ C:\ MinGW \ bin”,而不是正确的“ C:\ MinGW \ bin”。