Cgo: sorry, unimplemented: 64-bit mode not compiled in

后端 未结 3 1704
孤城傲影
孤城傲影 2021-02-20 08:10

I\'m currently trying to add some C code to my Go project. nothing fancy

/*
#include 
void test() {
    printf(\"hooola\")
}
*/

import (
    \"C\         


        
相关标签:
3条回答
  • 2021-02-20 08:15

    what worked for me was installing the 64 bit version of mingw adding it to PATH and then removing all other mingw's from PATH and then very important RESTARTING THE COMPUTER, you have to restart your computer.

    0 讨论(0)
  • 2021-02-20 08:19

    1- Short Answer:
    I tried many versions, the Only working version for both 32-bit and 64-bit go build in 64-bit Windows OS is tdm64-gcc-5.1.0-2.exe (see the tdm-gcc page).
    You may install it to C:\TDM-GCC-64\ and add C:\TDM-GCC-64\bin to your PATH (on top = or left).


    2- You may try MinGW-w64 - for 32 and 64-bit Windows Or x64-4.8.1-release-posix-seh-rev5.
    This versions works fine just for the 64-bit build (not 32-bit target on 64-bit OS).


    3- For Windows OS run your command prompt: cmd (terminal in Linux) then run this command (whereis gcc in Linux):

    where gcc
    

    Then if there are multiple gcc paths, then you may edit the order of these and put the one you need in the top or remove all others.


    4- See:

    Differences between Mingw-w64 and TDM-GCC for a simple GDI project

    What is the difference between Orwell's MinGW and TDM Dev-C++ versions?


    I hope this helps.

    0 讨论(0)
  • 2021-02-20 08:39

    Good answer, but what confused me is the MinGW-w64 installer choose the Architecture i686 by default instead of x

    0 讨论(0)
提交回复
热议问题