Why Am I Getting 'cc1.exe: sorry, unimplemented: 64-bit mode not compiled in' When Using Cgo?

Susan Sarandon
Release: 2024-11-12 04:20:02
Original
824 people have browsed it

Why Am I Getting

Cgo: 64-bit Mode Not Compiled In

When attempting to integrate C code into a Go project, the following error may occur:


cc1.exe: sorry, unimplemented: 64-bit mode not compiled in


This error typically stems from a discrepancy in the bit mode of the C compiler used.

Solution:

To resolve this issue, ensure that the C compiler used is compiled with support for 64-bit mode.

For Windows operating systems using MinGW-w64 as the C compiler, the following steps may be performed:

  1. Install TDM GCC 5.1.0-2.exe, which provides a 64-bit compiler suitable for use with Go.
  2. Add the path to the TDM GCC bin directory (e.g., C:TDM-GCC-64bin) to the system's PATH environment variable.
  3. Ensure that the TDM GCC compiler is prioritized over other compilers in the PATH by placing its directory at the beginning or top of the PATH variable.

Alternatively, another solution is to use MinGW-w64 or x64-4.8.1-release-posix-seh-rev5. These versions are known to work with 64-bit builds in 64-bit Windows OS but may not support 32-bit builds.

The above is the detailed content of Why Am I Getting 'cc1.exe: sorry, unimplemented: 64-bit mode not compiled in' When Using Cgo?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template