0

我将nodejs编译为静态库。我还在 nodejs 解决方案中添加了一个 exe 项目,并在其中使用了该库并且它有效。

然后我尝试将 nodejs 库与 libcef 一起使用。在 libcef 解决方案中,我给出了以下选项

Add additional library directory: # C:\blah\chromium\chromium\src\node\node\$(Configuration)\lib
Add additional library: # node.lib
Add additoinal include dir: # C:\blah\chromium\chromium\src\node\node\src

然后我尝试构建 libcef,它给出了 330 个链接器错误,例如:

245>     Creating library ..\build\Debug\lib\libcef.lib and object ..\build\Debug\lib\libcef.exp
245>node.lib(node_crypto.obj) : error LNK2019: unresolved external symbol _ERR_error_string_n referenced in function "class v8::Handle<class v8::Value> __cdecl node::crypto::ThrowCryptoErrorHelper(unsigned long,bool)" (?ThrowCryptoErrorHelper@crypto@node@@YA?AV?$Handle@VValue@v8@@@v8@@K_N@Z)
245>node.lib(node_crypto.obj) : error LNK2019: unresolved external symbol _SSL_CTX_free referenced in function "class v8::Handle<class v8::Value> __cdecl node::crypto::GetSSLCiphers(class v8::Arguments const &)" (?GetSSLCiphers@crypto@node@@YA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@4@@Z)
245>node.lib(node_crypto.obj) : error LNK2019: unresolved external symbol _SSL_CTX_sess_set_new_cb referenced in function "protected: static class v8::Handle<class v8::Value> __cdecl node::crypto::SecureContext::Init(class v8::Arguments const &)" (?Init@SecureContext@crypto@node@@KA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@5@@Z)

和其他人喜欢

241>node.lib(stream_wrap.obj) : error LNK2019: unresolved external symbol _uv_write referenced in function "public: static class v8::Handle<class v8::Value> __cdecl node::StreamWrap::WriteBuffer(class v8::Arguments const &)" (?WriteBuffer@StreamWrap@node@@SA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@4@@Z)
241>node.lib(stream_wrap.obj) : error LNK2019: unresolved external symbol _uv_shutdown referenced in function "public: static class v8::Handle<class v8::Value> __cdecl node::StreamWrap::Shutdown(class v8::Arguments const &)" (?Shutdown@StreamWrap@node@@SA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@4@@Z)
241>node.lib(stream_wrap.obj) : error LNK2019: unresolved external symbol _uv_write2 referenced in function "private: static class v8::Handle<class v8::Value> __cdecl node::StreamWrap::WriteStringImpl<0>(class v8::Arguments const &)" (??$WriteStringImpl@$0A@@StreamWrap@node@@CA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@3@@Z)
241>node.lib(node_stat_watcher.obj) : error LNK2019: unresolved external symbol _uv_fs_poll_init referenced in function "protected: __thiscall node::StatWatcher::StatWatcher(void)" (??0StatWatcher@node@@IAE@XZ)
241>node.lib(node_stat_watcher.obj) : error LNK2019: unresolved external symbol _uv_fs_poll_start referenced in function "protected: static class v8::Handle<class v8::Value> __cdecl node::StatWatcher::Start(class v8::Arguments const &)" (?Start@StatWatcher@node@@KA?AV?$Handle@VValue@v8@@@v8@@ABVArguments@4@@Z)
241>node.lib(node_stat_watcher.obj) : error LNK2019: unresolved external symbol _uv_fs_poll_stop referenced in function "private: void __thiscall node::StatWatcher::Stop(void)" (?Stop@StatWatcher@node@@AAEXXZ)

我在 node\Release\lib 中添加了所有库,例如 openssl.lib。

并且链接错误已减少到仅:

241>nss_static.lib(sha_fast.obj) : error LNK2005: _SHA1_Update already defined in openssl.lib(sha1dgst.obj)
241>nss_static.lib(seed.obj) : error LNK2005: _SEED_set_key already defined in openssl.lib(seed.obj)
241>nss_static.lib(seed.obj) : error LNK2005: _SEED_encrypt already defined in openssl.lib(seed.obj)
241>nss_static.lib(seed.obj) : error LNK2005: _SEED_decrypt already defined in openssl.lib(seed.obj)
241>nss_static.lib(seed.obj) : error LNK2005: _SEED_ecb_encrypt already defined in openssl.lib(seed_ecb.obj)
241>nss_static.lib(seed.obj) : error LNK2005: _SEED_cbc_encrypt already defined in openssl.lib(seed_cbc.obj)
241>nss_static.lib(sha512.obj) : error LNK2005: _SHA256_Update already defined in openssl.lib(sha256.obj)
241>nss_static.lib(sha512.obj) : error LNK2005: _SHA224_Update already defined in openssl.lib(sha256.obj)
241>nss_static.lib(sha512.obj) : error LNK2005: _SHA512_Update already defined in openssl.lib(sha512.obj)
241>nss_static.lib(sha512.obj) : error LNK2005: _SHA384_Update already defined in openssl.lib(sha512.obj)
241>nss_static.lib(md5.obj) : error LNK2005: _MD5_Update already defined in openssl.lib(md5_dgst.obj)
241>nss_static.lib(alghmac.obj) : error LNK2005: _HMAC_Init already defined in openssl.lib(hmac.obj)
241>nss_static.lib(alghmac.obj) : error LNK2005: _HMAC_Update already defined in openssl.lib(hmac.obj)

我该如何解决它们?

4

0 回答 0