我正在尝试将v8引擎嵌入到我的C ++应用程序中。我使用Visual C ++ 2010.我使用此命令成功构建它:
scons env="INCLUDE:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;C:\Program Files\Microsoft Visual Studio 10.0\VC\include,LIB:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib"
然后,我:
将 v8 / include 目录添加到配置属性 - > C / C ++ - >一般 - >其他包含目录
将 v8 / v8.lib 文件添加到配置属性 - >链接器 - >输入 - >附加依赖。
当我尝试从Getting Started页面编译基本的“Hello World”示例时,它会显示以下链接错误:
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__accept@12
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__listen@8
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__send@16
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__closesocket@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__freeaddrinfo@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__timeGetTime@0
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__socket@12
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__bind@12
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__recv@16
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__setsockopt@20
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__shutdown@8
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__ntohs@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__htons@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError@0
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__getaddrinfo@16
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__htonl@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__ntohl@4
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__WSAStartup@8
1>v8.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__connect@12
任何想法如何解决这个问题?
感谢。
答案 0 :(得分:11)
您需要链接到WinSock(Ws2_32.lib
)。