Vscode Debug Go language appears: exec: "gcc": Executable file not found in%PATH%

Source: Internet
Author: User
Tags posix
This is a creation in Article, where the information may have evolved or changed.

1, problem description

Due to the installation of VS15 Preview 5, the system was reinstalled once, and when compiling the go language with Vscdoe, the following issues occurred:

# ODBC
EXEC: "gcc": Executable file not found in%PATH%
Exit Status 2

2. Solutions

2.1 MinGW 64

MinGW is divided into earlier developed MinGW32 and later for the compilation of 64-bit program development MINGW-W64,MINGW32 can only compile 32-bit programs, and MINGW64 can not only compile 64-bit programs, but also compile 32-bit programs, but also to cross-compile, The 64-bit program is compiled on a 32-bit host and a 32-bit program is compiled on a 64-bit host.

Due to the use of WINDOW10 Enterprise Edition 64-bit operating system, to download MinGW 64-bit (official address: http://mingw-w64.org/doku.php), download address: https://sourceforge.net/projects/mingw-w64/

Click on the "Download" button,

2.2 Installation Instructions

Before using MINGW64, because it supports more compilation types, it has more installation packages and needs to know the naming rules for its installation packages: http://sourceforge.net/apps/trac/mingw-w64/wiki/download% 20filename%20structure

Generally use the two-version package compiled under the personal folder 64-bit program: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting% 20win64/personal%20builds/

Threads-win32 is the compiler target program is 32 bits, Threads-posix is the compiler target program is 64 bit

2.3 Installation Process

Install after download mingw-w64-install.exe (offline installation, slow, can):

Depending on the system environment, select the relevant configuration:

Select the installation path:

The download is slow, wait patiently ...

This installation process is in the torture of people, can download the corresponding compression package.

2.3 Environmental Testing

Under CMD, open the C:\mingw-w64\i686-6.2.0-posix-dwarf-rt_v5-rev1\mingw32\bin directory, enter Gcc-v, and appear as follows, stating that the installation was successful:

2.4 Uninstalling

Go to the C:\MINGW-W64\I686-6.2.0-POSIX-DWARF-RT_V5-REV1 directory and double-click Uninstall.exe to open the uninstaller, such as:

2.5 Installing through a compressed package

Download the compressed package and extract it to the C:\MINGW64 directory, such as:

Under the cmd window, go to C:\mingw64\bin, enter Gcc-v, as shown below:

OK, both methods are successful in this case.

3. Application Test

After the installation is successful, how do I get the go compiler to call GCC? To set the environment variable path, add C:\mingw64\bin below the PATH environment variable value as follows:

Compile the go language again, the problem is solved ~ ~ ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.