简体   繁体   English

C++ builder Android 无法编译应用程序?

[英]C++ builder Android fail to compile App?

An Android project is failing to compile within C++Builder 10.1 Berlin Update 2. Android 项目无法在 C++Builder 10.1 Berlin Update 2 中编译。

The IDE reports these errors: 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

I don't even use DynamicArray anywhere in the project.我什至不在项目中的任何地方使用DynamicArray I am using Windows 10. This was working fine with Windows 7.我使用的是 Windows 10。这在 Windows 7 上运行良好。

The error happens after I add a cpp file to the project.在我向项目添加 cpp 文件后发生错误。 And even if I remove the file from the project, the error remains.即使我从项目中删除了文件,错误仍然存​​在。 It's like the project is corrupted.就像项目损坏了一样。

This is the error:这是错误:

错误

Is this a bug for Android development on Windows 10 or something?这是 Windows 10 上的 Android 开发错误还是什么?

When I build an empty Android project, it compiles fine.当我构建一个空的 Android 项目时,它编译得很好。 But when I only add a file, it produces the DynamicArray error above.但是当我只添加一个文件时,它会产生上面的DynamicArray错误。 As you can see, the file code is commented, so there is no reason to give an error at all.如您所见,文件代码已被注释,因此完全没有理由给出错误。

Resolved:解决:

Just found a workaround.刚刚找到了一个解决方法。

The Networking unit that I was adding to the project was originally in a different folder that the project folder so for you to test it you need to move Networking some where else.我添加到项目中的网络单元最初位于与项目文件夹不同的文件夹中,因此为了测试它,您需要将网络移动到其他地方。

Coping the unit files in project directory before adding them fixes the issue for android compilation.在添加之前处理项目目录中的单元文件修复了 android 编译的问题。

But the problem will exits if I forget and added another unit from a different location.但是如果我忘记并从不同位置添加另一个单元,问题就会存在。 Even after removing that unit the problem remains.即使在移除该单元后,问题仍然存在。 It is like the project file has been infected with it.就好像项目文件被感染了一样。

Win7 Win7

  1. This compile error should be easy to resolve:这个编译错误应该很容易解决:

    PROBLEM:问题:

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

    SOLUTION:解决方案:

    #include <sysmac.h>

    #include <SystemTypes.h>

In other words, include "sysmac.h" before "SystemTypes.h"换句话说,在“SystemTypes.h”之前包含“sysmac.h”

  1. I understand that you THINK it works on Win7, but not on Win10 ... but that's probably just a "coincidence".我知道您认为它适用于 Win7,但不适用于 Win10……但这可能只是一个“巧合”。 Maybe you have a different SDK and/or compiler version, maybe it was installed differently ... there are a million possibilities.也许您有不同的 SDK 和/或编译器版本,也许它的安装方式不同……有一百万种可能性。 But it's unlikely the problem is "win7" vs. "win10" per se...但问题本身不太可能是“win7”与“win10”...

  2. In your example, you commented out every line in "Networking.h".在您的示例中,您注释掉了“Networking.h”中的每一行。 Why???为什么??? In general, you should never NEVER edit system headers.通常,您永远不要编辑系统标题。

  3. You might want to consider doing a "clean" of your project, and rebuilding from scratch.您可能需要考虑对您的项目进行“清理”,然后从头开始重建。

  4. You might even want to consider uninstalling and reinstalling C++ Builder and your Android SDK.您甚至可能需要考虑卸载并重新安装 C++ Builder 和您的 Android SDK。 Or installing it on a different PC.或者将其安装在不同的 PC 上。

I hope that helps...我希望这有帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM