mac下用brew更新了gcc,有很多头文件不能用了!
如题
比如说写一个helloworld
1 #include <stdio.h>
2 #include <stdlib.h>
3 int main(){
4 printf("Hello World!");
5 return EXIT_SUCCESS;
6 }
会出现以下错误
night:test mac$ gcc helloworld.c -o helloworld
In file included from helloworld.c:1:
/usr/local/Cellar/gcc/8.1.0/lib/gcc/8/gcc/x86_64-apple-darwin17.5.0/8.1.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
#include <_stdio.h>
^~~~~~~~~~
compilation terminated.
我看了这个路径下的这个文件,它里面确实加了一个下划线
1 /* DO NOT EDIT THIS FILE.
2
3 It has been auto-edited by fixincludes from:
4
5 "/usr/include/stdio.h"
6
7 This had to be done to correct non-standard usages in the
8 original, manufacturer supplied header file. */
9
10 #ifndef FIXINC_WRAP_STDIO_H_STDIO_STDARG_H
11 #define FIXINC_WRAP_STDIO_H_STDIO_STDARG_H 1
12
13 #define __need___va_list
14 #include <stdarg.h>
15 /*
16 * Copyright (c) 2000, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved.
17 *
18 * @APPLE_LICENSE_HEADER_START@
19 *
20 * This file contains Original Code and/or Modifications of Original Code
21 * as defined in and that are subject to the Apple Public Source License
22 * Version 2.0 (the 'License'). You may not use this file except in
23 * compliance with the License. Please obtain a copy of the License at
24 * http://www.opensource.apple.com/apsl/ and read it before using this
25 * file.
26 *
27 * The Original Code and all software distributed under the License are
28 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
29 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
30 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
31 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
32 * Please see the License for the specific language governing rights and
33 * limitations under the License.
34 *
35 * @APPLE_LICENSE_HEADER_END@
36 */
37 /*-
38 * Copyright (c) 1990, 1993
39 * The Regents of the University of California. All rights reserved.
40 *
41 * This code is derived from software contributed to Berkeley by
42 * Chris Torek.
43 *
44 * Redistribution and use in source and binary forms, with or without
45 * modification, are permitted provided that the following conditions
46 * are met:
47 * 1. Redistributions of source code must retain the above copyright
48 * notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 * notice, this list of conditions and the following disclaimer in the
51 * documentation and/or other materials provided with the distribution.
52 * 3. All advertising materials mentioning features or use of this software
53 * must display the following acknowledgement:
54 * This product includes software developed by the University of
55 * California, Berkeley and its contributors.
56 * 4. Neither the name of the University nor the names of its contributors
57 * may be used to endorse or promote products derived from this software
58 * without specific prior written permission.
59 *
60 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
61 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
63 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
64 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
66 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
68 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
69 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
70 * SUCH DAMAGE.
71 *
72 * @(#)stdio.h 8.5 (Berkeley) 4/29/95
73 */
74
75 #ifndef _STDIO_H_
76 #define _STDIO_H_
77
78 #include <_stdio.h>
还有好多这样的错误,我卸载重装也无济于事qwq
我好难过qwq
试一下执行命令: