2

I built the v8 libraries on visual studio 2005 in release mode, put the resulting .lib files (in release mode) and compiled my project against them.

While everything is working fine in debug mode (compiling and running correctly), in release mode I get the following link errors (as if the lib files are not there).

error LNK2001: unresolved external symbol "public: class v8::Local<class v8::Boolean> __thiscall v8::Value::ToBoolean(void)const " (?ToBoolean@Value@v8@@QBE?AV?$Local@VBoolean@v8@@@2@XZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsInt32(void)const " (?IsInt32@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsNumber(void)const " (?IsNumber@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsBoolean(void)const " (?IsBoolean@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsObject(void)const " (?IsObject@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsArray(void)const " (?IsArray@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsFunction(void)const " (?IsFunction@Value@v8@@QBE_NXZ)
error LNK2001: unresolved external symbol "public: bool __thiscall v8::Value::IsNull(void)const " (?IsNull@Value@v8@@QBE_NXZ)

My linker properties have the following additional depencies.

msvcrt.lib ntstc_msvcrt.lib Psapi.lib winmm.lib Ws2_32.lib $(SolutionDir)\external_libs\release\v8.lib

and my $(SolutionDir)\external_libs\release folder containst the files:

v8.lib, v8_base.lib, v8_snapshot.lib

Any help would be appreciated.

Sergey K.
  • 24,894
  • 13
  • 106
  • 174
  • What about the other 2 libs: `v8_base.lib, v8_snapshot.lib`? Are they not required to link? – Blazes May 27 '11 at 08:36

2 Answers2

3

In Visual Studio the build options are separate for debug and release builds. You probably set everything up properly for debug mode, but not for release mode, hence the errors.

I forget exactly how things are layed out in VS2005, but in VS2008, there is a combobox at the top of the solution properties dialog that lets you choose between debug/release/all configurations.

In other words, you will have to add the additional dependencies to the linker properties section in release mode. Alternatively, in the future, make all changes with the configuration set to All configurations.

dandan78
  • 13,328
  • 13
  • 64
  • 78
  • Thanks a lot for your help. Both comments were actually useful... I was actually doing the above but things got out of sync. as I was playing around, thanks for waking me up to it. – Adrian Basheer May 27 '11 at 13:00
  • I have one problem left (the edit window sends the message when I try to put a new line in this forum....), I am getting the following linking errors now in one line so I can post this... ' 1>v8_base.lib(platform-win32.obj) : error LNK2001: unresolved external symbol __imp__freeaddrinfo@4, _getaddrinfo@16, __set_abort_behavior, __imp__RtlCaptureContext@4, __HUGE ' given that my depedencies list is now: ' msvcrt.lib wininet.lib rasapi32.lib iphlpapi.lib Psapi.lib winmm.lib wsock32.lib Ws2_32.lib v8.lib v8_base.lib v8_snapshot.lib ' Any clues? – Adrian Basheer May 27 '11 at 13:06
  • I suggest making the additional dependencies the same as the ones in your debug build since it already works right. – dandan78 May 27 '11 at 13:28
  • They are the same actually now, hence my confusion.... The problem is that when I look up the unresolved externals, I find that the reason should be the winsock library, which is already included.... – Adrian Basheer Jun 01 '11 at 08:11
  • to make things neater, I starting this as a new question: http://stackoverflow.com/questions/6198266/v8-release-mode-linker-error-with-winsock – Adrian Basheer Jun 01 '11 at 08:26
0

Likely cause: The command switches and defines you used to build the v8 lib don't match those that you are using to build the code consuming it.

As an aside, if you are using the vs2005 CRT, you don't need this: ntstc_msvcrt.lib

Martyn

Martyn Lovell
  • 2,086
  • 11
  • 13