问题描述
我安装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:
在该文件中, 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
^
推荐答案
从下载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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!