构建C 插件时的错误,该解决方案是什么

Error while building c++ addon, whats the solution for it?

本文关键字:解决方案 是什么 错误 插件 构建      更新时间:2023-10-16

宏观化关键字错误

这是我要构建的代码:

#include <napi.h>
Napi::Object InitAll(Napi::Env env, Napi::Object exports) {
  return export;
}
NODE_API_MODULE(testaddon, InitAll)

即使实际使用它, export是C 中的关键字,因此return export是语法错误(就像其他任何尝试使用export的尝试一样)。

在猜测中,InitAll可能旨在返回相同的Napi::Object作为参数,因此应该是return exports;