Flutter项目在Windows系统使用ffigen生成代码时报下面的错误:
[SEVERE] : Couldn't find dynamic library in default locations.
[SEVERE] : Please supply one or more path/to/llvm in ffigen's config under the key 'llvm-path'.
Unhandled exception:
Exception: Couldn't find dynamic library in default locations.
#0 findDylibAtDefaultLocations (package:ffigen/src/config_provider/spec_utils.dart:371:3)
#1 Config._getRootConfigSpec.<anonymous closure> (package:ffigen/src/config_provider/config.dart:231:35)
#2 HeterogeneousMapConfigSpec._extractNode (package:ffigen/src/config_provider/config_spec.dart:320:16)
#3 ConfigSpec.extract (package:ffigen/src/config_provider/config_spec.dart:86:12)
#4 new Config.fromYaml (package:ffigen/src/config_provider/config.dart:192:22)
#5 new Config.fromFile (package:ffigen/src/config_provider/config.dart:201:19)
#6 getConfigFromCustomYaml (package:ffigen/src/executables/ffigen.dart:126:17)
#7 getConfig (package:ffigen/src/executables/ffigen.dart:78:14)
#8 main (package:ffigen/src/executables/ffigen.dart:48:14)
参考ffigen文档 ,安装LLVM以及Visual Studio(主要是下载C++),然后在ffigen.yaml文件中配置LLVM路径
llvm-path: - 'D:\LLVM'