我正在尝试使用ffigen为libtorrent生成绑定。
dart run ffigen --config ffigen.yaml的输出如下所示
Input Headers: [src2/include/libtorrent/libtorrent.hpp]
[SEVERE] : Header src2/include/libtorrent/libtorrent.hpp: Total errors/warnings: 1.
[SEVERE] : src2/include/libtorrent/libtorrent.hpp:4:10: fatal error: 'libtorrent/add_torrent_params.hpp' file not found [Lexical or Preprocessor Issue]
Finished, Bindings generated in /.../flutter/projects/dart_libtorrent/lib/bindings_generated.dart这是我的ffigen.yaml文件
# Run with `dart run ffigen --config ffigen.yaml`.
name: DartLibTorrentBindings
description: |
Bindings for `LibTorrent`.
Regenerate bindings with `dart run ffigen --config ffigen.yaml`.
output: "lib/bindings_generated.dart"
headers:
entry-points:
- "src2/include/libtorrent/libtorrent.hpp"
preamble: |
// ignore_for_file: always_specify_types
// ignore_for_file: camel_case_types
// ignore_for_file: non_constant_identifier_names
comments:
style: any
length: full我该怎么办?
我正在学习本教程:
https://blog.logrocket.com/dart-ffi-native-libraries-flutter/
发布于 2022-08-30 00:18:15
问题是clang找不到头,因为它需要一个额外的包含目录。
在我的示例中,我使用compiler-opts选项指定了标头位置,以将标志-I传递给编译器。
因此,我在我的ffigen.yaml中添加了接下来的行
compiler-opts:
- '-Isrc2/include/'答案可以在这里找到:https://github.com/dart-lang/ffigen/issues/452#issuecomment-1230829422
https://stackoverflow.com/questions/73501331
复制相似问题