如何编译现有的POSIX code的64位Windows? [英] How to compile existing posix code for 64-bit Windows?

查看:193
本文介绍了如何编译现有的POSIX code的64位Windows?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定与使用Cygwin或MinGW的,但我要结束了64位code,不是32位。这是因为,我会打电话从64位管理C#中的DLL。我似乎无法找到并设置这些工具来创建64位二进制很好的参考。此外,这将是很好,如果海湾合作委员会是4版本,而不是版本3的来到我的Cygwin的安装。

I'm ok with using Cygwin or MinGW, but I need to end up with 64-bit code, not 32-bit. This is because I will be calling the DLL from 64-bit managed C#. I can't seem to find and good references for setting up those tools to create 64-bit binaries. Also, it would be nice if the GCC was version 4, not version 3 as came with my Cygwin install.

另一种方法是某种形式的进程间通信。我将研究这一点,但我制定了以上是我真正想要的。

An alternative would be some form of interprocess communication. I will research that, but what I laid out above is what I really want.

推荐答案

href="http://sourceforge.net/projects/mingw-w64" rel="nofollow">的的基础上,(刚刚发布)GCC-4.4.0,可能是你最好的选择。 (由于在sourceforge.net MinGW的-W64项目正在向mingw-w64.org它更好地使用 mingw-w64.org

The 64-bit MinGW, based on (just released) gcc-4.4.0, is probably your best bet. (Since the mingw-w64 project on sourceforge.net is moving to mingw-w64.org it's better to use mingw-w64.org)

详细说明:
1.下载<一个href="http://sourceforge.net/project/downloading.php?group_id=202880&filename=mingw-w64-bin_i686-cygwin-1.5.25-15_20090514.tar.bz2&a=93736319"相对=nofollow>归档
2.解压到某个地方下Cygwin的。就我而言,顶级cygwin目录是 C:\ cygwin的,我提取封装成的MinGW 目录,结束了与以下内容 C:\ cygwin的\的MinGW (这是可见的 / MinGW的下的cygwin:

Detailed instructions:
1. Download the archive
2. Extract it somewhere under cygwin. In my case, top-level cygwin directory is C:\cygwin, I extracted the package into mingw directory, and ended up with the following contents in C:\cygwin\mingw (which is visible as /mingw under cygwin:

$ ls -l /mingw
total 1
drwxr-xr-x+ 2 user None  0 May 10 08:32 bin
drwxr-xr-x+ 2 user None  0 May 10 05:45 include
drwxr-xr-x+ 2 user None  0 May 10 08:30 info
drwxr-xr-x+ 3 user None  0 May 10 08:30 lib
drwxr-xr-x+ 3 user None  0 May 10 05:45 libexec
drwxr-xr-x+ 4 user None  0 May 10 05:45 man
lrwxrwxrwx  1 user None 17 May 17 17:20 mingw -> x86_64-pc-mingw32
drwxr-xr-x+ 3 user None  0 May 10 04:16 share
drwxr-xr-x+ 5 user None  0 May 10 04:18 x86_64-pc-mingw32

3。现在编译一些C ++ code。我使用的:

3. Now compile some C++ code. I used:

// t.cc
#include <vector>
#include <string>

using namespace std;
int main()
{
    vector<string> vs;
    vs.push_back("abc");
}

和编译它是这样的:

$ /mingw/bin/x86_64-pc-mingw32-g++ t.cc

4。最后,验证结果是Windows /×64可执行文件,运行 DUMPBIN /头A.EXE

Microsoft (R) COFF/PE Dumper Version 7.00.9466
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file a.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
            8664 machine (AMD64)
              10 number of sections
        4A10AF9F time date stamp Sun May 17 17:45:19 2009
           ABA00 file pointer to symbol table
             EC4 number of symbols
              F0 size of optional header
              27 characteristics
                   Relocations stripped
                   Executable
                   Line numbers stripped
                   Application can handle large (>2GB) addresses

这篇关于如何编译现有的POSIX code的64位Windows?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆