3

Linuxライブラリを移植してVxWorksで実行しようとしています。i486-wrs-vxworksをターゲットとするbinutilsとgccを正常にビルドし、単純なCプログラムを正常にビルドできます。ただし、C ++をコンパイルしようとすると、問題が発生します。

簡単なHelloWorldプログラムがあります。

#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
...

含める必要のあるものがもう1つyvals.hあるようですが、どこにも見つかりません。gccのビルドに失敗しただけですか、それともこれを修正する方法はありますか?

4

2 に答える 2

0

私は最近、クロス コンパイルの悪夢を経験しました (VxWorks 関連ではありません)。問題は、システム ヘッダー ファイルのインクルード パスを指定する必要があることでした。

エラーメッセージを解決するためにかかった手順は次のとおりです。必要に応じて自由に変更してください。

ファイル foo.c を作成します

#include <stddef.h>   /* The problem header file (yvals.h for you?) */

int main (void) {
    return 0;
}

選択したコンパイラでコンパイルします

$(CC) foo.c -E

使用するインクルード パスに注意し、それらをシステム ヘッダー ファイル リストとして設定します。

-isystem <include path>

オプション。

お役に立てれば。

于 2013-01-22T21:30:58.697 に答える