0
votes

I'm trying to install and check MinGW for debugging in MSVSCode.

I have run the MinGW installation Manager(mingw-get) GUI to install MinGW. I installed the following:

  • mingw-developer-toolkit-bin
  • mingw32-base-bin
  • mingw32-gcc-g++-bin
  • mingw32-gcc-objc-bin
  • msys-base-bin

and I have verified that it is working, as follows:-

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.

User Variables 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;

System Variables Path:-

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;

If I type

C:\Users>gcc -v

I receive the error message

'gcc' is not recognised as an internal or external command, operable program or batch file.

However, If I type

C:\Users>set PATH=C:\MinGW\bin;%PATH%

and then I write

C:\Users>gcc -v

Then I get...

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)

However, only for as long as this command console window is open.

My operating system is Windows 7 Home Premium Service Pack 1 64-bit Operating System.

Is there any way to get this working so that I don't need to write set PATH each time, and so that it works in MSVSCode?

Any help advice much appreciated

1

1 Answers

1
votes

Unless it is a typo, your environment variables as pasted in the question seem to contain an extra space:

...C:\Program Files\Microsoft VS Code\bin; C:\MinGW\bin;
                                          ^

This makes the system search the (non-existing) path " C:\MinGW\bin" rather than the correct "C:\MinGW\bin".