私はBFDライブラリを使用しようとしているので、パッケージをインストールbinutils-dev
して含めました:
#include <bfd.h>
私のコードからなどを呼び出しbfd_openr
ています。bfd_close
最近、パッケージをアップグレードしましたが、ここからエラーが発生します。
bfd.h:
/* PR 14072: Ensure that config.h is included first. */
#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif
...含める必要がありますconfig.h
-しかし、私はautoconfを使用していません。
間違ったヘッダー ファイルをインクルードしていませんか? binutils-dev はどのように使用するのですか?
ここにデモプログラムがあります:
#include <stdio.h>
#include <bfd.h>
int main()
{
bfd_init();
bfd* file = bfd_openr("a.out", 0);
if (!file)
return -1;
if (bfd_check_format(file, bfd_object))
printf("object file\n");
else
printf("not object file\n");
bfd_close(file);
return 0;
}
次のようにコンパイルして実行してみてください。
$ sudo apt-get install binutils-dev
$ gcc test.c
In file included from test.c:3:0:
/usr/include/bfd.h:37:2: error: #error config.h must be included before this header