问题描述
我使用win-builds安装了MinGW-w64.一切正常,但是当我使用
I installed MinGW-w64 using win-builds.It all went ok but then when I compile a file using
我收到此错误
我已经更新了gcc路径.当我尝试在Eclipse上构建时,出现相同的错误.Win-builds放置所有文件的位置是C:\Program Files\win-builds-1.5.0\
,并且文件夹\include\
存在.
I have updated gcc path. I get the same error when I try to build on eclipse.The location where win-builds put all the files is C:\Program Files\win-builds-1.5.0\
and the folder \include\
exists.
我的猜测是cc1.exe
试图访问C:\Program Files\win-builds-1.5.0\include
,但是由于某些原因,它会将Files\win-builds-1.5.0\include
的C:\Program
分开.
My guess is that cc1.exe
is trying to access C:\Program Files\win-builds-1.5.0\include
but, for some reason it is separating C:\Program
of Files\win-builds-1.5.0\include
.
如何使编译器正常工作?
How can I get the compiler to work?
这是要编译的代码
/*
* main.c
*
* Created on: 13/06/2018
* Author: haslima
*/
#include <stdio.h>
int main()
{
printf("Hello World");
return 1;
}
当我运行gcc -v -c -o prog.exe main.c
时,我得到以下输出:
when I run gcc -v -c -o prog.exe main.c
I get this output:
Reading specs from c:/program files/win-builds-1.5.0/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/specs
COLLECT_GCC=gcc
Target: x86_64-w64-mingw32
Configured with: ../gcc-4.8.3/configure --prefix=/opt/windows_64 --with-sysroot=/opt/windows_64 --libdir=/opt/windows_64/lib64 --mandir=/opt/windows_64/man --infodir=/opt/windows_64/info --enable-shared --disable-bootstrap --disable-multilib --enable-threads=posix --enable-languages=c,c++ --enable-checking=release --enable-libgomp --with-system-zlib --with-python-dir=/lib64/python2.7/site-packages --disable-libunwind-exceptions --enable-__cxa_atexit --enable-libssp --with-gnu-ld --verbose --enable-java-home --with-java-home=/opt/windows_64/lib64/jvm/jre --with-jvm-root-dir=/opt/windows_64/lib64/jvm --with-jvm-jar-dir=/opt/windows_64/lib64/jvm/jvm-exports --with-arch-directory=amd64 --with-antlr-jar='/home/adrien/projects/win-builds-1.5/slackware64-current/d/gcc/antlr-*.jar' --disable-java-awt --disable-gtktest --build=x86_64-slackware-linux --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
Thread model: posix
gcc version 4.8.3 (GCC)
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'prog.exe' '-mtune=generic' '-march=x86-64'
c:/program files/win-builds-1.5.0/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.3/cc1.exe -quiet -v -iprefix c:\program files\win-builds-1.5.0\bin\../lib64/gcc/x86_64-w64-mingw32/4.8.3/ -D_REENTRANT -IC:/Program Files/win-builds-1.5.0/include main.c -quiet -dumpbase main.c -mtune=generic -march=x86-64 -auxbase-strip prog.exe -version -o C:\Users\hasli\AppData\Local\Temp\ccnpAzB7.s
GNU C (GCC) version 4.8.3 (x86_64-w64-mingw32)
compiled by GNU C version 4.8.3, GMP version 5.1.3, MPFR version 3.1.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/program files/win-builds-1.5.0/lib64/gcc/../../lib64/gcc/x86_64-w64-mingw32/4.8.3/include"
ignoring nonexistent directory "/opt/windows_64/opt/windows_64/lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../include"
ignoring duplicate directory "c:/program files/win-builds-1.5.0/lib64/gcc/../../lib64/gcc/x86_64-w64-mingw32/4.8.3/include-fixed"
ignoring duplicate directory "c:/program files/win-builds-1.5.0/lib64/gcc/../../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "/opt/windows_64/mingw/include"
ignoring nonexistent directory "C:/Program"
#include "..." search starts here:
#include <...> search starts here:
c:\program files\win-builds-1.5.0\bin\../lib64/gcc/x86_64-w64-mingw32/4.8.3/include
c:\program files\win-builds-1.5.0\bin\../lib64/gcc/x86_64-w64-mingw32/4.8.3/include-fixed
c:\program files\win-builds-1.5.0\bin\../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/include
End of search list.
cc1.exe: fatal error: Files/win-builds-1.5.0/include: No such file or directory
compilation terminated.
推荐答案
来自> [MinGW]:入门(包括粗体):
因此,解决方案非常简单:
So, the solution is pretty straightforward:
- 卸载当前版本(可能没有必要,但没有必要破坏某些内容)
- 请务必阅读所有安装要求/说明
- 将其安装在免费的 dir 中的 SPACE 中
- Uninstall your current version (might not be necessary, but there's no point keeping something broken)
- Make sure to read all installation requirements / notes
- Install it in a SPACE free dir
我应该早点想到这一点,因为我没有在默认目录中安装东西(例如,我在"f:\ Install \ pc064 \ MinGW \ MinGW-中安装了 MinGW W64 \ x86_64-8.1.0-posix-seh-rt_v6-rev0").
I should have thought of this sooner, as I don't install stuff in default dirs (e.g. I have MinGW installed in "f:\Install\pc064\MinGW\MinGW-W64\x86_64-8.1.0-posix-seh-rt_v6-rev0").
这篇关于用MinGW编译C程序会导致cc1.exe致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!