【发布时间】:2013-01-22 17:49:27
【问题描述】:
我正在尝试移植一个 Linux 库以在 VxWorks 上运行。我已经成功构建了 binutils 和 gcc 来定位 i486-wrs-vxworks 并且我可以成功构建一个简单的 C 程序。但是,当我尝试编译 C++ 时,事情就中断了。
我有一个简单的 Hello World 程序:
#include <string>
#include <iostream>
int main()
{
std::string s = "Hello World";
std::cout << s << std::endl;
return 0;
}
为了构建它,我调用:
i486-wrs-vxworks-gcc -I/home/kyle/vxworks-6.9/target/usr/h -I/home/kyle/vxworks-6.9/target/usr/h/c++ hello.cpp
这总是失败并显示消息:
In file included from /home/kyle/vxworks-6.9/target/usr/h/c++/cerrno:4:0,
from /home/kyle/vxworks-6.9/target/usr/h/c++/xlocnum:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/ios:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/ostream:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/istream:4,
from /home/kyle/vxworks-6.9/target/usr/h/c++/string:4,
from hello.cpp:1:
/usr/local/lib/gcc/i486-wrs-vxworks/4.6.4/../../../../i486-wrs-vxworks/include/yvals.h:4:24: fatal error: yvals.h: No such file or directory
如果我去看看/usr/local/i486-wrs-vxworks/include/yvals.h,我看到的就是这个:
/* yvals.h values header for conforming compilers on various systems */
#if (defined(__cplusplus) && defined(__GNUC__))
/* GCC C++ has it's own yvals.h */
#include_next <yvals.h>
#else /* __cplusplus && __GNUC__ */
#ifndef _YVALS
#define _YVALS
#ifdef _NO_WINDRIVER_MODIFICATIONS
#include <stdarg.h>
#endif
...
似乎还有另一个yvals.h 需要包含在内,但我在任何地方都找不到。我只是未能正确构建 gcc,还是有办法解决这个问题?
【问题讨论】:
-
你试过
i486-wrs-vxworks-g++吗? -
@MatsPetersson 是的,它给出了同样的错误。
-
在
/usr/local/i486-wrs-vxworks/include/yvals.h中是否还有另一个包含yvals.h- 通常这些系统文件稍后会包含另一个...不幸的是,我不知道您问题的答案,所以我只能引导您沿着我要调查的道路前进。 -
在
/usr/local/i486-wrs-vxworks/include/yvals.h中有一行#include_next <yvals.h>表明在某处应该有另一个yvals.h...不幸的是,据我所知,它实际上并不存在。运行find / -name yvals.h只会返回我已经知道的yvals.h。 -
所以,这就是它出错的“yvals.h”——我不完全确定它应该包含什么。就像一个黑客一样,你有没有试过只注释掉那一行(#include_next yvals)?
标签: c++ gcc cross-compiling vxworks