静态链接V8

时间:2015-02-03 18:46:29

标签: c++ visual-c++ v8 embedded-v8

我有一个动态与V8完美配合的项目,但我想静态嵌入它。我可以成功编译V8作为静态,但当我在我的C ++项目中包含生成的库(我也改为静态链接)时,我得到这样的错误:

Error   12  error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall v8::HandleScope::HandleScope(class v8::Isolate *)" (__imp_??0HandleScope@v8@@QAE@PAVIsolate@1@@Z)

我还有很多其他错误。我看过一些帖子提到了v8.lib,但它不存在。但是,有一个v8.obj文件。

非常欢迎任何见解,谢谢。

1 个答案:

答案 0 :(得分:2)

发现问题。它实际上已在v8.h文件的顶部清楚地说明了:

// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
// static library or building a program which uses the V8 static library neither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.

我还有' USING_V8_SHARED'定义。感谢@drescherjm指出我正确的方向。 ;)

相关问题