android - NDK错误: “can' t resolve `.data.rel.ro.loc

Android/NDK项目,一直使用NDK版本直至r8c。在8d和8e下,我在armeabi-v7a构建上收到编译错误消息:

Compile++ thumb  : myproject <= MyFile.cpp
C:\cygwin\tmp\ccFXOc2F.s: Assembler messages:
C:\cygwin\tmp\ccFXOc2F.s:1935: Error: can't resolve `.data.rel.ro.local' {.data.rel.ro.local section} - `.LPIC44' {*UND* section}

同一项目的armeabi,MIPS和x86构建成功。

它可靠地 pop 在同一文件上。该文件没什么特别的- Vanilla C++,它可以在许多其他平台(iOS,Windows,NDK r8c等)上编译并运行。没有STL。尽管它确实定义了一定数量的字符串常量(也称为AKA初始化的只读/只读数据)。可能会发生什么?

已经尝试了完全重建,甚至完全删除了obj文件夹。

C++标志是:
LOCAL_CPPFLAGS := -fshort-wchar -fsigned-char -Wno-psabi

我知道NDK随附了多个版本的GCC;工具链更改可能会有所帮助吗?到底如何

最佳答案

在我看来,这肯定是一个编译器错误。它与对大量静态const数据的索引访问有关。当我略微改写了一个完全无辜的声明时,错误消息消失了。

以前是:

//In global scope
static const LPCWSTR Comments[] = {L"A lot of strings here", L"String 2", L"String 3" /* and many more */ }:

void SomeMethod()
{
    DoSomething(Comments[i]); //That was the offending line - commenting it out would get rid the error
}

替换为:
void SomeMethod()
{
    static LPCWSTR pComments = 0;
    if(!pComments)
        pComments = Comments;

    DoSomething(pComments[i]); //Now it works.
}

好的,怪异的东西。

关于android - NDK错误: “can' t resolve `.data.rel.ro.local' ”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15574587/

相关文章:

compiler-errors - JRE 抛出的 fatal error

qt - 无法运行编译qt应用程序。 Qt Creator忽略斜线

compiler-errors - 在NME中定位-演示项目无法转换为例如JavaScript-目标

c++ - 无法解析的外部符号C++-错误的声明?

compiler-errors - 这怎么了? Submit.CommandText = SQL?

scala - 斯卡拉(Scala),卡斯巴(Casbah): MongoCollection.in

sql - Qt QSql类错误

java - Play Framework CompilationException

php - 在XPath评估之前,如何处理字符串中的双引号?

variables - 无法编译::I don't understand my errors. Mo