我有一个想通过Emscripten交叉编译的程序。所以我创建了一个静态库foo_core
,现在尝试通过以下方式将其链接到html页面:
$ em++ -std=c++11 -s VERBOSE=1 main.cpp.o -o example.html libfoo_core.js
VERBOSE is on, this generates a lot of output and can slow down compilation
adding ___cxa_atexit and deps atexit
adding _atexit and deps
warning: unresolved symbol: _Z12fooiiii
现在,我当然可以尝试找出原因_Z12fooiiii
。最后做:
$ grep -r _Z12fooiiii *
example.html: __Z12fooiiii(50, 50, 50, 255);
libfoo_core.js:,0,__Z12fooiiii,0,__ZNSt3__16locale5facetD2Ev,0,__ZTv0_n12_NSt3__113basic_istreamIwNS_11char_traitsIwEEED1Ev,0,__ZNSt3__112system_errorD0Ev
libfoo_core.js:function __Z12fooiiii($r, $g, $b, $a) {
揭示该函数实际上存在于中libfoo_core.js
。所以我现在很困惑,非常感谢有人向我解释为什么这行不通。
如果您编译位码并且库中有足够的字符.bc
(例如libfoo_core.bc
),它就可以工作!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句