I followed the downloading and building V8 doc and successfully built v8 library. However, I failed to follow “Getting Started” guide to compile the hello world example.
g++ -Iinclude -pthread -o hello_world hello_world.cc lib64/libicudata.a lib64/libv8_base.x64.a lib64/libv8_nosnapshot.x64.a lib64/libv8_snapshot.a
hello_world.cc: In function 'int main(int, char**)':
hello_world.cc:23:27: error: 'New' is not a member of 'v8::String'
hello_world.cc:32:22: error: 'class v8::Persistent
hello_world.cc:35:3: error: 'AsciiValue' is not a member of 'v8::String'
hello_world.cc:35:22: error: expected ';' before 'ascii'
hello_world.cc:36:19: error: 'ascii' was not declared in this scope
make: *** [hello_world] Error 1
I am sure that this has nothing to do with library, it may be caused by prototype mismatch. But why failed? I trusted the docs, it should work!
After several hours of experiment and googling, I gave up. tried to checkout an older version instead(here I checked out version 220.127.116.11 from svn tag http://v8.googlecode.com/svn/tags/18.104.22.168). Compile the example ode again, everything works like magic!
Note, when build the lastest version(currently 3.24.5), you may also encounter error like this:
make: Entering directory `/home/curu/src/v8/out'
cc1plus: warnings being treated as errors
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/bits/stl_algo.h: In member function 'void v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(v8::internal::Call*, v8::internal::HValue*, v8::internal::SmallMapList*, v8::internal::Handle
We can see that the error information is related to gcc itself, update GCC to 4.6 should solve this prolem.
The out-of-date document hurt me a lot. Great software should come with great and up-to-date document, espically for Open Source Software.