How return the window Find Static Library?

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

How return the window Find Static Library?

Postby Lena » Fri May 05, 2017 12:08 am

Hi.
I use this article:
How to use Android Service(TAndroidService) in C++Builder
I try to add services in my project with TBeacon.
When compile I got errors:
Unabled to find static library: libdelphiandroidservises.a, libvclie.a....
I saw window "Find Static Library". I set "Remove the reference" and set "Don't ask me again". The compilation was successful.
Today I open project and got errors again but I don't see window "Find Static Library".
How to get window "Find Static Library" back now and fix this errors?
Code: Select all
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -ldelphiandroidservices
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lvclactnband
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lvclx
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lvcl
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lvclimg
[ldandroid Error] C:\Users\Public\Documents\Embarcadero\Studio\18.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lvclie
Lena
BCBJ Master
BCBJ Master
 
Posts: 524
Joined: Sun Feb 06, 2011 1:28 pm

Re: How return the window Find Static Library?

Postby rlebeau » Fri May 05, 2017 1:32 pm

VclActnBand, Vclx, Vcl, VclImg, VclIE - those are all VCL libraries for Windows only, they are not FMX libraries, and as such are not available for Android. It sounds like you started with a VCL project instead of a FMX project. Start over and try again.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1457
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: How return the window Find Static Library?

Postby Lena » Fri May 05, 2017 10:17 pm

1. I have С++ Builder berlin Android project with component of TBeacon and the project works successfully on my phone.
2. Now I am using the standard Delphi example for Android service. In the service I add the component TBeacon. This component cannot be used in Windows. Compilation is successful.
3. Add this service in my Android project. Then compile project and got errors.
Android service code:
Code: Select all
//---------------------------------------------------------------------------
// Copyright (c) 2016 Embarcadero Technologies, Inc. All rights reserved. 
//
// This software is the copyrighted property of Embarcadero Technologies, Inc.
// ("Embarcadero") and its licensors. You may only use this software if you
// are an authorized licensee of Delphi, C++Builder or RAD Studio
// (the "Embarcadero Products").  This software is subject to Embarcadero's
// standard software license and support agreement that accompanied your
// purchase of the Embarcadero Products and is considered a Redistributable,
// as such term is defined thereunder. Your use of this software constitutes
// your acknowledgement of your agreement to the foregoing software license
// and support agreement.
//---------------------------------------------------------------------------
unit BeaconServiceUnit;

interface

uses
  System.SysUtils,
  System.Classes,
  System.Android.Service,
  AndroidApi.JNI.GraphicsContentViewText,
  Androidapi.JNI.Os, System.Beacon, System.Notification, System.Beacon.Components,
  System.Bluetooth;

type
  TBeaconServiceDM = class(TAndroidService)
    Beacon1: TBeacon;
    NotificationCenter1: TNotificationCenter;
    procedure Beacon1BeaconProximity(const Sender: TObject; const ABeacon: IBeacon; Proximity: TBeaconProximity);
    function AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags, StartId: Integer): Integer;
    procedure Beacon1BeaconEnter(const Sender: TObject; const ABeacon: IBeacon;
      const CurrentBeaconList: TBeaconList);
  private
    { Private declarations }
    procedure NotifyBeaconProximity(const BeaconName: string);
  public
    { Public declarations }
  end;

var
  BeaconServiceDM: TBeaconServiceDM;

implementation

{%CLASSGROUP 'FMX.Controls.TControl'}

{$R *.dfm}

uses
  Androidapi.JNI.App;

function TBeaconServiceDM.AndroidServiceStartCommand(const Sender: TObject; const Intent: JIntent; Flags,
  StartId: Integer): Integer;
begin
  Beacon1.Enabled := True;
  Result := TJService.JavaClass.START_STICKY;
end;

procedure TBeaconServiceDM.Beacon1BeaconEnter(const Sender: TObject;
  const ABeacon: IBeacon; const CurrentBeaconList: TBeaconList);
 var Major, Minor : Word;
begin
  //NotifyBeaconProximity('BE: ' + ABeacon.GUID.ToString + ':' + ABeacon.Major.ToString + ',' + ABeacon.Minor.ToString);

   Major := ABeacon.Major;
   Minor := ABeacon.Minor;
   IF(Major <> 10) OR (Minor <> 1)then
      begin
        exit;
      end;

  NotifyBeaconProximity('Hello!');

end;

procedure TBeaconServiceDM.Beacon1BeaconProximity(const Sender: TObject; const ABeacon: IBeacon;
  Proximity: TBeaconProximity);
begin
  //if Proximity = TBeaconProximity.Immediate then
    //NotifyBeaconProximity(ABeacon.GUID.ToString + ':' + ABeacon.Major.ToString + ',' + ABeacon.Minor.ToString);
end;

procedure TBeaconServiceDM.NotifyBeaconProximity(const BeaconName: string);
var
  MyNotification: TNotification;
begin
  MyNotification := NotificationCenter1.CreateNotification;
  try
    MyNotification.Name := 'BeaconProximityNotification';
    //MyNotification.AlertBody := 'Beacon Proximity detected: '+  BeaconName;
    MyNotification.AlertBody := BeaconName;
    NotificationCenter1.PresentNotification(MyNotification);
  finally
    MyNotification.Free;
  end;
end;

end.
Attachments
132.jpg
132.jpg (53.88 KiB) Viewed 3663 times
Lena
BCBJ Master
BCBJ Master
 
Posts: 524
Joined: Sun Feb 06, 2011 1:28 pm

Re: How return the window Find Static Library?

Postby rlebeau » Sat May 06, 2017 12:33 am

Lena wrote:3. Add this service in my Android project. Then compile project and got errors.


Sounds like another IDE bug.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1457
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA

Re: How return the window Find Static Library?

Postby Lena » Sat May 06, 2017 2:16 am

When I saw the window Find Static Library I was able to compile. Is there a way to return this window?
Lena
BCBJ Master
BCBJ Master
 
Posts: 524
Joined: Sun Feb 06, 2011 1:28 pm

Re: How return the window Find Static Library?

Postby corbingravely » Thu Oct 19, 2017 11:30 am

Hope This helps.

This is something i referred from another forum.

Let's say that I am using UEStudio to build a default static library project using the default static library template supplied with UEStudio MinGW configuration. Let's call the project name TestLib. In addition to the default int InitLibrary(void) function supplied in the cpp file, I just want to add a function in this static library to print out the words "Test Print".

TestStaticLib.h file:

Code: Select all
#include "stdio.h"
#include <iostream>

void TestPrint ();

TestStaticLib.cpp file:

Code: Select all
#include "TestStaticLib.h"

int InitLibrary(void)
{
return 1;
}

void TestPrint (){

std::cout << "Test Print" << std::endl;
}

That is it. I build the static library without errors or warnings, and UEStudio outputs the files: TestStaticLib.a, TestStaticLib.o

This ends the process of building a static library using UEStudio ...

Now here is where the problems starts ...

I now try to build a default console project using the default console template, call it TestConsole, and bring in the TestStaticLib:

TestConsole.h file:

Code: Select all
#include "stdio.h"
#include "TestStaticLib.h"

TestConsole.cpp file:

Code: Select all
#include "TestConsole.h"

int main(int argc, char* argv[])
{

TestPrint ();
return 0;
}

Compiler configurations:

Under compiler options:

Additional Include Directories = C:\Static\TestStaticLib (where the TestStaticLib.h file resides)

Under Linker Options:

Libraries = -lstdc++ -lkernel32 -user32 -lgdi32 -lcomctl32 -lcomdlg32 -lTestStaticLib (note that is -lTestStaticLib for Link)
LibraryPath = C:\Static\TestStaticLib\Debug

When I build, I got the error:

Code: Select all
c:/program files (x86)/idm computer solutions/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../mingw32/bin/ld.exe: cannot find -lTestStaticLib

I have put in every possible paths, under compiler options, linker options that I know of, so I really cannot understand why I still get the error message saying it cannot finds -lTestStaticLib.

I am hoping my description is cleared and hoping someone can shed some lights into this issue and/or point me to the correct direction.

Just out of curiosity, do I have to prefix my static library name with "lib" as in "libTestStaticLib" instead of just "TestStaticLib"?

Thanks again.
corbingravely
 
Posts: 7
Joined: Tue Jan 21, 2014 11:08 pm


Return to Technical

Who is online

Users browsing this forum: Google [Bot] and 9 guests