如何在cygwin中配置gcc? [英] How to configure gcc in cygwin?

查看:434
本文介绍了如何在cygwin中配置gcc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装cygwin与gcc 4.8.3(编译c ++)。一切都很好,直到我决定构建一个32位可执行文件:编译错误出现时,我编译代码 #include< cstdlib> 我使用 stdlib.h 而不是 cstdlib )。

I installed cygwin with gcc 4.8.3 (to compile c++). All was well until I decided to build a 32-bit executable: a compilation error appeared when I compiled the code #include <cstdlib> (the error doesn't appear if I use stdlib.h instead of cstdlib).

经过一些挖掘,我找到了以下文件:

After some digging, I found the following file:


/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/ include / c ++ / x86_64-pc-cygwin / bits / c + + config.h

/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/x86_64-pc-cygwin/bits/c++config.h

在该文件中, p>

In that file, I have:

/* Define if __int128 is supported on this host. */
#define _GLIBCXX_USE_INT128 1

如果我删除此代码,编译错误将消失。

If I remove this code, the compilation error disappears.

这是调整我的gcc配置的正确方法吗? (我几乎可以肯定不是)

Is this the right way to tune my gcc configuration? (I am almost sure it isn't)

如果没有,我应该怎么办?

If not, how should I do it?

为了参考,这里是我在说的编译错误:

For reference, here is the compilation error I was talking about:


$ echo '#include <cstdlib>' | g++ -c -m32 -x c++ -
In file included from <stdin>:1:0:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/cstdlib:178:10: error: expected unqualified-id before ‘__int128’
   inline __int128
          ^


推荐答案

GCC镜像站点下载tarball。并遵循INSTALL指令。

Download the tarball from one of GCC mirror sites. And follow the INSTALL instructions. It's very straightforward, just did it again for 4.9.1.

对于你的问题,你 a 32位机?无需黑客源代码。您是否正确运行 ./ configure ?您的机器是否支持128位 int 可能 ./ configure 的参数,以指定是或否。

For your problem, are you on a 32bit machine? There's no need to hack the source code. Have you run ./configure properly? Does your machine support 128bit int? There probably be a parameter to ./configure to state this yes or no.

这篇关于如何在cygwin中配置gcc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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