最近,我尝试构建并运行google v8的示例hello world程序。 我的xcode版本是4.0.2GA,x86_64。
指南的链接:get Started
但是在运行命令时: g ++ -Iinclude hello_world.cpp -o hello_world libv8.a -lpthread
错误显示:
ld: warning: ignoring file libv8.a, file was built for archive which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"v8::Context::Enter()", referenced from:
v8::Context::Scope::Scope(v8::Handle<v8::Context>)in ccJsmYlc.o
"v8::V8::DisposeGlobal(v8::internal::Object**)", referenced from:
v8::Persistent<v8::Context>::Dispose() in ccJsmYlc.o
"v8::Context::Exit()", referenced from:
v8::Context::Scope::~Scope()in ccJsmYlc.o
"v8::HandleScope::HandleScope()", referenced from:
_main in ccJsmYlc.o
"v8::Context::New(v8::ExtensionConfiguration*, v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Value>)", referenced from:
_main in ccJsmYlc.o
"v8::String::New(char const*, int)", referenced from:
_main in ccJsmYlc.o
"v8::Script::Compile(v8::Handle<v8::String>, v8::ScriptOrigin*, v8::ScriptData*, v8::Handle<v8::String>)", referenced from:
_main in ccJsmYlc.o
"v8::Script::Run()", referenced from:
_main in ccJsmYlc.o
"v8::String::AsciiValue::AsciiValue(v8::Handle<v8::Value>)", referenced from:
_main in ccJsmYlc.o
"v8::String::AsciiValue::~AsciiValue()", referenced from:
_main in ccJsmYlc.o
"v8::HandleScope::~HandleScope()", referenced from:
_main in ccJsmYlc.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status.
答案 0 :(得分:2)
很明显,您正在尝试与为其他架构构建的.a链接。查看How do I determine the target architecture of static library (.a) on Mac OS X?以了解如何检查该.a的目标体系结构。一旦你知道你可以重新定位你的项目,或者为x86_64架构创建一个新的libv8.a。