【问题标题】:C++ builder Android fail to compile App?C++ builder Android无法编译App?
【发布时间】:2017-09-24 19:20:17
【问题描述】:

一个 Android 项目无法在 C++Builder 10.1 Berlin Update 2 中编译。

IDE 报告以下错误:

bccaarm command line for "MainU.cpp"
  c:\program files (x86)\embarcadero\studio\18.0\bin\bccaarm.exe -cc1 -D _DEBUG -n .\Android\Debug -isysroot 
  C:\Users\MIDO\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\platforms\android-14\arch-arm -idirafter =\usr\include -idirafter 
  C:\Users\MIDO\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include -idirafter 
  C:\Users\MIDO\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include -idirafter 
  C:\Users\MIDO\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi-v7a\include -idirafter 
  C:\Users\MIDO\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\sources\android\native_app_glue -I "D:\L-Development\AUB Projects\AUB 
  Apps\Mobile\AUBE Branch Contacts" -I "c:\program files (x86)\embarcadero\studio\18.0\include\android\fmx" -I "..\..\..\..\Main Library\Units" -I 
  "C:\Users\Ahmed Sayed\Desktop\ActivitiesXE6\ActivitiesXE6" -I "..\..\..\..\Main Library\Units\FMX" -I "..\..\..\..\Main Library\Classes" -I 
  "..\..\..\..\Main Library\Clients\FMX\Frames" -I "D:\L-Development\Main Library\Units\FMX" -I "D:\L-Development\Main Library\Classes" -I 
  "D:\L-Development\Main Library\Clients\FMX\Frames" -I "..\..\..\..\Desktop\AUBE Contacts Test" -isystem "C:\Program Files 
  (x86)\Woll2Woll\FirePower\10.0\include\18.0\Android" -isystem "c:\program files (x86)\embarcadero\studio\18.0\include" -isystem "c:\program files 
  (x86)\embarcadero\studio\18.0\include\android\rtl" -isystem "c:\program files (x86)\embarcadero\studio\18.0\include\android\fmx" -isystem "c:\program 
  files (x86)\embarcadero\studio\18.0\include\android\crtl" -isystem C:\Users\Public\Documents\Embarcadero\Studio\18.0\hpp\Android -g 
  -fno-limit-debug-info -fborland-extensions -fborland-auto-refcount -nobuiltininc -nostdsysteminc -triple thumbv7-none-linux-androideabi -emit-obj 
  -mconstructor-aliases -pic-level 2 -target-abi aapcs-linux -target-cpu cortex-a8  -nostdinc++ -fdeprecated-macro -fexceptions -fcxx-exceptions 
  -munwind-tables -mstackrealign -fno-spell-checking -main-file-name MainU.cpp -x c++ -std=c++11 -O2 -fmath-errno -tU -o .\Android\Debug\MainU.o 
  -dependency-file .\Android\Debug\MainU.d -MT .\Android\Debug\MainU.o MainU.cpp 
[bccaarm Error] SystemTypes.h(1278): implicit instantiation of undefined template 'System::DynamicArray<unsigned char>'
  sysmac.h(603): template is declared here
[bccaarm Error] SystemTypes.h(1286): implicit instantiation of undefined template 'System::DynamicArray<unsigned char>'
  sysmac.h(603): template is declared here
[bccaarm Error] SystemTypes.h(1292): implicit instantiation of undefined template 'System::DynamicArray<unsigned char>'
  sysmac.h(603): template is declared here
[bccaarm Error] MainU.cpp(1): ICE: Internal compiler error: C0000005 @ 548FD234

我什至不在项目中的任何地方使用DynamicArray。我使用的是 Windows 10。这在 Windows 7 上运行良好。

在我将 cpp 文件添加到项目后发生错误。即使我从项目中删除文件,错误仍然存​​在。好像项目损坏了。

这是错误:

这是在 Windows 10 上进行 Android 开发的错误吗?

当我构建一个空的 Android 项目时,它编译得很好。但是当我只添加一个文件时,它会产生上面的DynamicArray 错误。可以看到,文件代码被注释掉了,所以完全没有理由报错。

已解决:

刚刚找到解决方法。

我添加到项目中的网络单元最初与项目文件夹位于不同的文件夹中,因此为了测试它,您需要将网络移动到其他位置。

在添加之前复制项目目录中的单元文件可以解决android编译的问题。

但如果我忘记并从不同位置添加了另一个单元,问题就会消失。即使在移除该单元之后,问题仍然存在。就好像项目文件被感染了一样。

Win7

【问题讨论】:

  • "我也不在项目中的任何地方使用 DynamicArray" - 错误在系统标头中,而不是在您的代码中。 System::TArraySystem::DynamicArray 的 typedef,System::Byteunsigned char 的 typedef。编译器抱怨 System::DynamicArray 尚未定义,甚至告诉你定义它的头文件。确保 sysmac.h 包含在 SystemTypes.h 之前
  • 你的意思是我应该编辑 SystemTypes.h 还是按顺序将它们都放在我的主窗体单元中:sysmac.h 然后 SystemTypes.h?
  • 不要编辑 SystemTypes.h!!!只需确保以正确的顺序包含正确的标题即可。
  • 很抱歉,谁能告诉我具体应该做什么以及在哪里?
  • @AhmedSayed 这与操作系统或 Win32 SDK 无关

标签: android c++ c++builder dynamic-arrays


【解决方案1】:
  1. 这个编译错误应该很容易解决:

    问题:

    [bccaarm Error] SystemTypes.h(1278): implicit instantiation of undefined template 'System::DynamicArray<unsigned char>' sysmac.h(603): template is declared here

    解决方案:

    #include &lt;sysmac.h&gt;

    #include &lt;SystemTypes.h&gt;

换句话说,在“SystemTypes.h”之前包含“sysmac.h”

  1. 我了解您认为它适用于 Win7,但不适用于 Win10……但这可能只是一个“巧合”。也许你有不同的 SDK 和/或编译器版本,也许它的安装方式不同......有一百万种可能性。但问题不太可能是“win7”与“win10”本身......

  2. 在您的示例中,您注释掉了“Networking.h”中的每一行。为什么???一般来说,你永远不应该编辑系统头文件。

  3. 您可能需要考虑“清理”您的项目,然后从头开始重建。

  4. 您甚至可能需要考虑卸载并重新安装 C++ Builder 和您的 Android SDK。或者将其安装在不同的 PC 上。

希望对你有帮助……

【讨论】:

  • 感谢您的回复,但您希望我在哪里包含这些标题:#include ,#include 在主窗体单元或项目源中?
  • 我评论了“Networking.h”中的每一行,看看是否有一行代码会产生错误,因为我在项目中添加了其他文件,它们不会导致这个问题跨度>
猜你喜欢
  • 2023-01-09
  • 1970-01-01
  • 2014-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-09
  • 1970-01-01
  • 2017-04-11
相关资源
最近更新 更多