gpt4 book ai didi

javascript - 在 Mac OS X 上使用 SWIG 为 javascript 编译 C++

转载 作者:行者123 更新时间:2023-11-30 05:44:38 35 4
gpt4 key购买 nike

我正在尝试为 javascript 编译 SWIG 输出文件,但它无法编译并作为输出给出错误列表。有人可以告诉我如何为此目的包含 V8 库吗?输出文件是用这个命令生成的

swig -c++ -javascript -v8 example.i

列表中的一些错误:

example_wrap.cxx:769:9: error: no type named 'Arguments' in namespace 'v8'; did
you mean 'v8::internal::Arguments'?typedef v8::Arguments SwigV8Arguments;

用于编译的命令:

gcc -c example_wrap.cxx -Iv8/include

我采集的所有 sample from the official website of SWIG

最佳答案

生成包装器类时应提供v8的版本。

brew install swig
brew install v8
swig -c++ -javascript -v8 -DV8_VERSION=0x041027 example.i
gcc -c example_wrap.cxx -I /usr/local/Cellar/v8/4.1.0.27/include/

关于javascript - 在 Mac OS X 上使用 SWIG 为 javascript 编译 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29699370/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com