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

后端 未结 3 1638
孤城傲影
孤城傲影 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: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.

提交回复
热议问题