简体   繁体   English

在Mac OS X上用SWIG for javascript编译C ++

[英]Compiling C++ with SWIG for javascript on Mac OS X

I am trying to compile SWIG output file for javascript, but it fails to compile and gives as an output a list of errors. 我正在尝试为JavaScript编译SWIG输出文件,但编译失败,并给出了错误列表。 Could someone tell me how to include V8 libraries for this purpose? 有人可以告诉我如何为此目的包括V8库吗? The output file was generated with this command 输出文件是使用此命令生成的

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

Some Error from the list: 列表中的一些错误:

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

The command which used to compile: 用于编译的命令:

gcc -c example_wrap.cxx -Iv8/include

All samples I have taken from the official website of SWIG 从SWIG的官方网站上获取的所有样本

v8's version should be provided when generating wrapper class. 生成包装器类时,应提供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/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM