2016-10-04 8 views
1

現在、GoプロジェクトにCコードを追加しようとしています。空想Cgo:実装されていません:64ビットモードがコンパイルされていません

/* 
#include <stdio.h> 
void test() { 
    printf("hooola") 
} 
*/ 

import (
    "C" 
) 

func MessageBox() { 
    C.test() 
} 

何もないしかし、これは

cc1.exe返します。申し訳ありませんが、実装されていない:

にコンパイルされていない64ビットモード私はg++gccコンパイラをチェックし、すべてがそうです良い、g++ -vこれを返す

C:\Users\ragga>g++ -v 
Using built-in specs. 
COLLECT_GCC=g++ 
COLLECT_LTO_WRAPPER=C:/Program\ Files/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/6.2.0/lto-wrapper.exe 
Target: x86_64-w64-mingw32 
Configured with: ../../../src/gcc-6.2.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw620/x86_64-620-posix-seh-rt_v5-rev1/mingw64 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-isl-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw620/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw620/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw620/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw620/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev1, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw620/x86_64-620-posix-seh-rt_v5-rev1/mingw64/opt/include -I/c/mingw620/prerequisites/x86_64-zlib-static/include -I/c/mingw620/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw620/x86_64-620-posix-seh-rt_v5-rev1/mingw64/opt/include -I/c/mingw620/prerequisites/x86_64-zlib-static/include -I/c/mingw620/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw620/x86_64-620-posix-seh-rt_v5-rev1/mingw64/opt/lib -L/c/mingw620/prerequisites/x86_64-zlib-static/lib -L/c/mingw620/prerequisites/x86_64-w64-mingw32-static/lib ' 
Thread model: posix 
gcc version 6.2.0 (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 
私は私の問題はどこから来ているかわからないので、

gcc --versionながら戻り、この

g:\Workspace\Go\src\github.com\raggaer\snak>gcc --version 
gcc (GCC) 4.8.1 
Copyright (C) 2013 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. 

の両方がmingw64bitsを使用してインストールされていますか?

+0

'gcc -v'の出力は何ですか' gcc'のバージョンは 'g ++'と比較して古すぎると思われます。おそらく、複数の 'gcc'インストールがあります。 – putu

答えて

5

の1-短い答え:
私は、64ビットの寡婦OSの両方の32ビットおよび64ビットgo buildのためだけの作業バージョンは、あなたがC:\TDM-GCC-64\にそれをインストールしてPATH(一番上にC:\TDM-GCC-64\binを追加することができtdm64-gcc-5.1.0-2.exe
ある多くのバージョンを試してみました=または左)。


2 - あなたはMinGW-w64 - for 32 and 64 bit Windows またはx64-4.8.1-release-posix-seh-rev5をしようとします。
このバージョンは、64ビットビルド(64ビットOSでは32ビットターゲットではありません)の場合のみ正常に動作します。 WindowsのOSの場合


3 - あなたのコマンドプロンプトを実行します。cmd(Linuxでは、端末)、その後(Linuxの中whereis gcc)このコマンドを実行します。

where gcc 

その後、複数のgccのパスがある場合、あなたはこれらの順序を編集し、必要なものを上に置くか、他のものをすべて削除することができます。


、4-項目:

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?


私はこのことができます願っています。

関連する問題