Please follow the provided instructions: Compile hello_world.cpp, linking to the static libraries created in the > build process. For example, on 64bit Linux using the GNU compiler: > g++ -Iinclude hello_world.cc -o hello_world > out/x64.release/obj.target/tools/gyp/libv8_{base,snapshot}.a -lpthread
Simply omitting the reference to the libraries is not going to work. Since you built with "make native", you'll have to adapt the path to "out/native/...". On Tue, Oct 2, 2012 at 3:49 PM, 劉君羿 <trantor....@gmail.com> wrote: > I am using ubuntu 10.04 on x86_64 machine. > I built v8 with *"make native"*, > and copied and pasted the > *hello_world.cc<https://developers.google.com/v8/get_started> > *to the root directory of v8. > I typed *"g++ -Iinclude hello_world.cc hello_world"*, and it gave me the > following error: > * > * > /tmp/ccjmXg7T.o: In function `main': > hw.cc:(.text+0x26): undefined reference to `v8::HandleScope::HandleScope(* > *)' > hw.cc:(.text+0x53): undefined reference to > `v8::Context::New(v8::**ExtensionConfiguration*, > v8::Handle<v8::ObjectTemplate>**, v8::Handle<v8::Value>)' > hw.cc:(.text+0x79): undefined reference to `v8::String::New(char const*, > int)' > hw.cc:(.text+0xb4): undefined reference to > `v8::Script::Compile(v8::**Handle<v8::String>, > v8::ScriptOrigin*, v8::ScriptData*, v8::Handle<v8::String>)' > hw.cc:(.text+0xda): undefined reference to `v8::Script::Run()' > hw.cc:(.text+0x114): undefined reference to `v8::String::AsciiValue::** > AsciiValue(v8::Handle<v8::**Value>)' > hw.cc:(.text+0x13f): undefined reference to `v8::String::AsciiValue::~** > AsciiValue()' > hw.cc:(.text+0x155): undefined reference to `v8::String::AsciiValue::~** > AsciiValue()' > hw.cc:(.text+0x193): undefined reference to `v8::HandleScope::~** > HandleScope()' > hw.cc:(.text+0x1b5): undefined reference to `v8::HandleScope::~** > HandleScope()' > /tmp/ccjmXg7T.o: In function `v8::Context::Scope::Scope(v8:** > :Handle<v8::Context>)': > hw.cc:(.text._**ZN2v87Context5ScopeC1ENS_**6HandleIS0_EE[v8::Context::** > Scope::Scope(v8::Handle<v8::**Context>)]+0x2b): undefined reference to > `v8::Context::Enter()' > /tmp/ccjmXg7T.o: In function `v8::Context::Scope::~Scope()'**: > hw.cc:(.text._**ZN2v87Context5ScopeD1Ev[v8::**Context::Scope::~Scope()]+**0x1c): > undefined reference to `v8::Context::Exit()' > /tmp/ccjmXg7T.o: In function `v8::Persistent<v8::Context>::**Dispose()': > hw.cc:(.text._**ZN2v810PersistentINS_**7ContextEE7DisposeEv[v8::** > Persistent<v8::Context>::**Dispose()]+0x2c): undefined reference to > `v8::V8::DisposeGlobal(v8::**internal::Object**)' > collect2: ld returned 1 exit status > > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users