1

我有一个与 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 文件。

任何见解都将受到欢迎,谢谢。

4

1 回答 1

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 为我指明了正确的方向。;)

于 2015-02-03T19:09:15.933 回答