首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >颤振效应与激流

颤振效应与激流
EN

Stack Overflow用户
提问于 2022-08-26 12:53:06
回答 1查看 142关注 0票数 0

我正在尝试使用ffigen为libtorrent生成绑定。

dart run ffigen --config ffigen.yaml的输出如下所示

代码语言:javascript
复制
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文件

代码语言:javascript
复制
# 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/

EN

回答 1

Stack Overflow用户

发布于 2022-08-30 00:18:15

问题是clang找不到头,因为它需要一个额外的包含目录。

在我的示例中,我使用compiler-opts选项指定了标头位置,以将标志-I传递给编译器。

因此,我在我的ffigen.yaml中添加了接下来的行

代码语言:javascript
复制
compiler-opts:
  - '-Isrc2/include/'

答案可以在这里找到:https://github.com/dart-lang/ffigen/issues/452#issuecomment-1230829422

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73501331

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档