LPUTF8StrC# 中的字符串封送处理对我来说根本不起作用。我觉得我无法正确理解它的用例,但是在仔细研究文档并进行各种其他测试之后,我不确定我做错了什么。
首先,陈述我对字符编码的基本(可能不正确)理解以及为什么 C# 需要转换它们,以防出现问题:
\nconst char*和std::string)默认使用单字节字符。您可以使用包含两字节字符的字符串,但只有在您选择使用时才会使用这些字符串std::wstring(我没有这样做)。\\xhh,其中hh是字节的十六进制编码。例如。"\\xF0\\x9F\\xA4\\xA0"相当于“”。我正在运行 Ubuntu 18.04.1 LTS,并尝试让 Half Life 的游戏库在 Xash3D 引擎中运行。它们构建正常,但是当我尝试运行引擎时,我收到以下令人困惑的错误:
undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
Run Code Online (Sandbox Code Playgroud)
经过一些互联网研究后,我认为这基本上可以解决“VTable for __cxxabiv1::__si_class_type_info”。我已经安装了libc++abi-dev、libc++-dev、libc++abi1以及libc++1它们的 i386 对应版本(因为我必须以 32 位进行编译),所以我不知道为什么运行时链接会失败。
如果有帮助的话,我发现半条命存储库中的其他库(特别是死亡竞赛经典库)也可以工作。我检查了 makefile,DMC 库没有任何LDFLAGS设置,而标准的 Half Life 库使用:
LDFLAGS= -lm -lstdc++
Run Code Online (Sandbox Code Playgroud)
有什么原因导致我在这里收到链接器错误吗?我可以做什么来修复它们?
编辑:我正在使用 GCC/G++ 7.3.0。如果有帮助,我正在使用的库的 makefile 在这里:
有效的:https://github.com/ValveSoftware/halflife/blob/master/linux/Makefile.dmcdll
没有的:https://github.com/ValveSoftware/halflife/blob/master/linux/Makefile.hldll
我还在*_map.txt编译生成的文件中搜索了“libc”。这就是现在的情况:
在工作 DMC 映射文件中:
Archive member included to satisfy reference by file (symbol)
/usr/lib/i386-linux-gnu/libc_nonshared.a(stack_chk_fail_local.oS)
/home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/animating.o (__stack_chk_fail_local)
As-needed library included to satisfy reference by file (symbol)
libstdc++.so.6 /home/vesper/Documents/afterburner-game/build/game/obj/dmcdll/nodes.o (operator new[](unsigned …Run Code Online (Sandbox Code Playgroud) 到目前为止,我无法在Google上找到关于以下内容的解释,这让我感到困惑.
我有一个Scene存储层次结构SceneObjects.该Scene充当模板SceneObject厂,所以当簿记可以做到SceneObject创建或删除子类的实例.这两个类都在它们自己的动态链接模块中,并且位于模块命名空间内(不确定这是否重要).
(简化)SceneObject类看起来像这样:
// SceneObject is a base class, but is not pure.
class SceneObject
{
// The parent Scene needs to be able to access protected functions.
friend class Scene;
protected:
// This is protected to enforce the factory design pattern.
// We don't want SceneObjects created without being tied to a Scene.
SceneObject(Scene* parentScene, SceneObject* parentObject);
public:
...
};
Run Code Online (Sandbox Code Playgroud)
而(简化)Scene类看起来像这样:
class Scene
{
public: …Run Code Online (Sandbox Code Playgroud)