账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    mac下用brew更新了gcc,有很多头文件不能用了!头疼
    29
    0

    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

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 听够假话 普通会员 1楼

      在Mac下使用brew更新GCC时,可能会遇到一些问题。这些问题可能包括找不到特定的头文件或库文件,或者更新过程中出现问题。

      解决这些问题的方法有几种:

      1. 检查你的PATH环境变量:确保你的PATH环境变量中包含了你的GCC安装路径。你可以通过在终端中输入"echo $PATH"来检查你的PATH环境变量。

      2. 更新你的GCC源代码:确保你的GCC源代码是最新的。你可以通过在终端中输入"brew update"来检查你的GCC源代码。

      3. 更新你的CMakeLists.txt文件:如果你使用CMake进行项目管理,确保你的CMakeLists.txt文件是最新的。你可以通过在终端中输入"brew upgrade cmake"来检查你的CMakeLists.txt文件。

      4. 重新安装GCC:如果你的问题依然存在,你可能需要重新安装GCC。你可以通过在终端中输入"brew uninstall gcc"然后输入"brew install gcc"来重新安装GCC。

      5. 使用其他GCC版本:如果你的GCC版本与你的系统版本不兼容,你可能需要使用其他版本的GCC。你可以通过在终端中输入"brew install gcc@8"来安装GCC版本8。

      如果你尝试了以上所有方法,但问题依然存在,那么你可能需要寻求专业的帮助。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部