V8 JavaScript Engine 编译与使用注意事项-使用V8

 

二 使用V8

 

1. 使用静态库版本,必须引入winmm.lib和ws2_32.lib

#pragma comment(lib,"winmm.lib") #pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"libv8-vc90-mt.lib")

否则会得到类似下面的错误:

error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "public: void __thiscall v8::internal::Time::SetToCurrentTime(void)" (?SetToCurrentTime@Time@internal@v8@@QAEXXZ)
error LNK2019: unresolved external symbol __imp__bind@12 referenced in function "public: virtual bool __thiscall v8::internal::Win32Socket::Bind(int)" (?Bind@Win32Socket@internal@v8@@UAE_NH@Z )

2.链接CRT方式保持一致

如果你写的程序是动态链接CRT(即/MD),那么使用的v8库也要是使用动态链接CRT编译的版本;否则会得到这样的警告:

1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

你可能感兴趣的:(JavaScript,function,socket,library)