RTC Forums
November 24, 2024, 02:10:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: 'undefined reference' error when deploying a C++Builder Project to Android  (Read 8149 times)
dex
RTC Expired
*
Posts: 10


« on: December 13, 2015, 12:16:04 PM »

Hi,

When trying to deploy a simple project containing any RTC component in RAD Studio 10 Seattle (C++ personality) to Android platform I get a list of 'undefined reference' errors to Rtcsyncobjs, RtcInfo, Rtcthrpool, etc., like the following:

[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: .\Android\Debug\rtcFMX.GUI.o: in function Rtcfmx::Gui::TSyncRtcTimer::rtcSync(void (* __closure)()):C:\Components\RTC715\Lib/rtcFMX.GUI.pas:85: error: undefined reference to 'Rtcsyncobjs::TRtcEvent::TRtcEvent(bool, bool)'

The very same MultiDevice (C++) project reports no errors for Win32 target platform.

Such basic project with no just a couple of standard controls + RtcFMX.GUI.pas unit added to the project + e.g. RtcHttpClient deploys to connected Android phone just fine.

What am I missing?

Dejan





Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: December 13, 2015, 01:20:12 PM »

If the components are correctly installed in the IDE (you can add them to a Form) and the Library path is correctly set for the target platfom (you can compile and deploy a new Project to your desired tartet platform after adding RTC components to the Form), then your problem is most likely a broken Project file. The only solution to that problem (which I know of) is to create a new Project file and add all the units from your old Project to the new Project. After that, you should be able to compile and deploy your new Project to your desired target platform.

Best Regards,
Danijel Tkalcec
Logged
dex
RTC Expired
*
Posts: 10


« Reply #2 on: December 13, 2015, 02:14:31 PM »

Thank you for quick response!

Here is what I did:
1. Start completely new Multi-Device (C++) project, choose Blank Application, and delete all Target Platforms except 32-bit Windows and Android.

2. I save the project to a new folder, then compile and deploy it successfully first for Win32, then also for Android. So far, everything is fine and an empty form shows up indicating running application in both cases.

3. Next, I add rtcFMX.GUI.pas to the project. Project compiles and runs for Win32. However, though it compiles for Android, in linking stage I get above mentioned errors.

So, I don't think the issue is related to broken Project file. I should mention that when I add standard fmx controls, like TEdit, TMemo, TStringGrid, TidHTTP, etc. on the form, project is deployed as expected to both target platforms. However, if I try to use RTC, be it just rtcFMX.GUI.pas unit or also some additional components, I will end up with errors when deploying to Android platform, whereas Win32 is ok.

Dejan


Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: December 13, 2015, 02:30:47 PM »

Is the RTC SDK "Lib" folder in the Library path for the C++ compiler and Android platform?

Best Regards,
Danijel Tkalcec
Logged
dex
RTC Expired
*
Posts: 10


« Reply #4 on: December 13, 2015, 03:07:18 PM »

Hi,

In Project Options, C++ (Shared Options), for Target: All configurations - All platforms, path to RTC SDK 'Lib' folder is shown in both 'Include path' and 'Library path'.

I was trying to solve this for two days, thinking it must be some silly omission on my part.

Regards,
Dejan
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #5 on: December 13, 2015, 03:55:33 PM »

You need to manually configure Library paths for each platform individually.

Under the "Tools" / "Options" menu, select "Environment Options" / "Delphi Options" / "Library" in the left tree, then (on the right side) you will see a "Selected Platform" label with a drop-down list. Select the platform you want to target and check the "Library Paths" field below. If you don't see the RTC SDK "Lib" folder in there, add it and confirm. Do this for EVERY PLATFORM SEPARATELY (change the platform in the "Selected Platform" list and repeat the process).

If you are using the C++ compiler, you will most likely also need to add the RTC SDK "Lib" path to "Include paths" and "Library paths" for each platform individually.

Best Regards,
Danijel Tkalcec
Logged
dex
RTC Expired
*
Posts: 10


« Reply #6 on: December 13, 2015, 04:58:55 PM »

It was there from the beginning. Adding 'Lib' path for every platform that will be used is described in Readme.txt file included in RTC SDK zip package, which I followed closely. In past two days I have repeated the procedure at least 5 times, installing RTC SDK to newly installed RAD Studio 10.

The only deviation I made was that after opening "SDKPackages_Main" Project Group and before selecting "Build All", I quickly changed C++ output file generation of Delphi Compiler from 'Generate DCUs only' to 'Generate all C++Builder files (including package libs)'. (Right-click on the package name in Package Manager, choosing Options, then in Project Options, Delphi Compiler, Output - C/C++, C/C++ Output file generation) in order to get lib files for C++ compiler.

Regards,
Dejan
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #7 on: December 13, 2015, 10:41:24 PM »

Instructions in the Readme file are for Delphi, not for C++Builder. I am not a C++Builder developer, so I can not help you much with issues related to C++Builder setup, but ... since you have managed to install the components in the IDE and your Project compiles and runs on the Win32 platform, my guess is that the problem is either:

(A) with the C++Builder compiler for Android not being able to find all the source files (which would be the case if paths to source files are not configured correctly), or

(B) the C++Builder linker for Android being unable to find the files generated by the compiler (mixing Delphi and C++Builder source files requires both compilers to be configured correctly), or

(C) Delphi or C++Builder compiler not generating new header files for Delphi units when compiling to different target platforms (which might be the case if the same folder is used for Delphi unit header files for all platforms and should be fixed by using a different folder for HPP files of each target platform).

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 16 queries.