【问题标题】:XGCC stdarg.h NO SUCH FILE OR DIRECTORYXGCC stdarg.h 没有这样的文件或目录
【发布时间】:2016-02-19 09:01:37
【问题描述】:

我在我的项目中包含了 vsprintf。但是,当我编译它时,我收到以下错误。

/opt/xgcc/decstation-ultrix/bin/xgcc -DIN_USER_MODE -c -I../userprog -I../threads -G 0 -Wall -O2 -DCHANGED -c vsprintf.c
vsprintf.c:12: stdarg.h: No such file or directory
make[1]: *** [vsprintf.o] Error 1
rm add.o
make[1]: Leaving directory `/home/banana/se31/code/test'
make: *** [all] Error 2

vsprintf 的第 12 行包含以下内容:

#include <stdarg.h>

我使用以下短程序验证了 stdarg.h 已正确安装在我的系统中。

//test.c and test.cpp
#include <stdarg.h>

int main(void)
{
   return 0;
}

当我运行 gcc test.c 或 gcc test.cpp 时,我没有收到任何错误,这表明我的 vsprint.c 和 gcc 已正确安装。

我在 stackoverflow 中遇到过类似的问题,但还没有找到解决方案。我使用 Ubuntu 32 位作为我的操作系统。有人可以指导我如何解决这个问题吗?

【问题讨论】:

  • “当我运行 gcc test.c 或 gcc test.cpp 时,我没有收到任何错误”——但首先给你错误的不是 gcc,所以检查它没有意义。错误由/opt/xgcc/decstation-ultrix/bin/xgcc 给出。
  • xgcc 使用 gcc 和 g++ 的功能并将其转换为 mips。我正在开发一个名为link 的迷你操作系统项目。我正在为 linux link 使用 NACHOS 的交叉编译器。编译器依赖于 gcc 和 g++。这就是我测试 gcc 的原因。
  • "xgcc 使用 gcc 和 g++ 的功能并将其转换为 mips。" ——不,它没有。它不使用主机 gcc 的功能,它是专门配置的 gcc 的单独独立安装,事实上,如果它使用主机的头文件,事情会很糟糕,因为主机的头文件不是为 mips 编写的。
  • 你说得对,我使用的是 xgcc 交叉编译器,而不是系统范围的 gcc。这已通过包含 stdarg.h 文件并重新编译 xgcc 得到修复。谢谢...

标签: c++ c gcc nachos


【解决方案1】:

作为hvd

指出。我在错误的地方检查 stdarg.h。要修复它,必须将 stdarg.h 添加到我的项目中。从那里,交叉编译器 (xgcc) 能够编译程序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-29
    • 2012-05-06
    • 2021-06-24
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多