I downloaded and built JS V8 for using in VS2010 in Release mode. Now I try run Hello World example:
#include "v8.h"
int _tmain(int argc, _TCHAR* argv[])
{
v8::HandleScope handle_scope;
v8::Persistent<v8::Context> context = v8::Context::New();
v8::Context::Scope context_scope(context);
v8::Handle<v8::String> source = v8::String::New("'Hello' + ', World'");
v8::Handle<v8::Script> script = v8::Script::Compile(source);
v8::Handle<v8::Value> result = script->Run();
context.Dispose();
v8::String::AsciiValue ascii (result);
printf ("%s\n", *ascii);
return 0;
}
I added Additional Dependencies:
"C:\v8\build\Release\lib\preparser_lib.lib"
"C:\v8\build\Release\lib\v8_base.lib"
When I try to compile and run the program, I encountered a linking error:
1>------ Build started: Project: V8_example, Configuration: Release Win32 ------
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>v8_base.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__inet_addr@4
...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
When I have set "Ignore All Default Libraries: Yes(/NODEFAULTLIB)", these errors showed up:
1>------ Build started: Project: V8_example, Configuration: Release Win32 ------
1>v8_base.lib(strtod.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
1>v8_base.lib(full-codegen-ia32.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
...
1>c:\users\admin\documents\visual studio 2010\Projects\V8_example\Release\V8_example.exe : fatal error LNK1120: 141 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Has anyone tried to run this example or know how to fix these errors?
The error is caused by the missing symbol __imp__inet_addr@4
, which is located in Ws2_32.lib
.
Go to project Properties -> Linker -> Input -> Additional Dependencies. Simply add Ws2_32.lib
and you're done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With