Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding v8 with Visual C++ 2010

I'm trying to embed the v8 engine to my C++ application. I use Visual C++ 2010. I've built it successfully using this command:

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"

And then, I:

  • added the v8/include directory to Configuration Properties -> C/C++ -> General --> Additional Include Directories

  • added the v8/v8.lib file to Configuration Properties -> Linker -> Input -> Additional Dependencies.

When I try to compile the basic "Hello World" example from the Getting Started page, it shows me the following linking error:

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

Any ideas how to fix this?

Thanks.

like image 932
Alon Gubkin Avatar asked Jun 27 '10 23:06

Alon Gubkin


1 Answers

You need to link to WinSock (Ws2_32.lib).

like image 179
Alexander Gessler Avatar answered Sep 24 '22 01:09

Alexander Gessler