【问题标题】:How to fix 'memmove' not declared error in log4cxx如何修复 log4cxx 中未声明的“memmove”错误
【发布时间】:2019-05-23 05:13:04
【问题描述】:

我正在尝试从 x86_64 机器为 ARM 交叉编译 log4cxx。编译时出现'memmove' was not declared in this scope的错误提示。

我使用的是 Linaro GCC 交叉编译器版本 4.9.4。为了防止交叉编译出现不同的问题,我将CPPFLAGS=-DAPR_IOVEC_DEFINED 提供给配置命令。这是 log4cxx 源的 0.10.0 版本,从 Apache Logging Services website 下载。

完整的错误信息如下:

inputstreamreader.cpp:66:64: error: 'memmove' was not declared in this scope
              memmove(buf.data(), buf.current(), buf.remaining());

我知道“未声明”错误通常表示未包含带有声明的文件,但在发布的代码中这似乎不太可能成为问题。

【问题讨论】:

    标签: log4cxx


    【解决方案1】:

    此错误是由于文件中缺少包含路径,尽管 log4cxx Git 存储库中的提交消息表明该错误仅发生在某些版本的 GCC 编译器中。

    要修复错误,请将以下包含添加到src/main/cpp/inputstreamreader.cpp

    #include <cstdio>
    #include <cstring>
    

    这些包含在 most recent version of the file 中,可在 log4cxx Github 存储库中找到。这些包含的添加是自 0.10.0 版以来对文件的唯一非格式更改。在文件的 commit history 中,提到了 GCC 4.3 和 4.4 的问题,因为缺少包含。

    我还遇到了来自 log4cxx 中其他文件的其他 not declared 错误。它们可以以相同的方式修复,并已在 Github 存储库中修复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多