Recent

Author Topic: How to use an external library in my component?  (Read 5120 times)

safa

  • New Member
  • *
  • Posts: 17
How to use an external library in my component?
« on: December 26, 2015, 12:06:12 pm »
I created a component , and I need to use IdHttp component (Indy) in it, so first I installed Indy in my IDE,I created the component and istalled it, then I added to uses the unit IdHttp so I can use IdHttp in my component. But, when I compile the code of my component I get this error: Can't find unit IdHttp used by "mycomponent". So how to fix this?
It's never too late, it's never too early, it's always the right moment.

balazsszekely

  • Guest
Re: How to use an external library in my component?
« Reply #1 on: December 26, 2015, 12:32:06 pm »
Add indylaz to the required packages of your component.

safa

  • New Member
  • *
  • Posts: 17
Re: How to use an external library in my component?
« Reply #2 on: December 26, 2015, 02:45:33 pm »
Add indylaz to the required packages of your component.
I already tried your suggestion, however when I recompile the component I get the same compilation error.
It's never too late, it's never too early, it's always the right moment.

balazsszekely

  • Guest
Re: How to use an external library in my component?
« Reply #3 on: December 26, 2015, 03:28:13 pm »
Quote
@safa
I already tried your suggestion, however when I recompile the component I get the same compilation error.
From where did you install indy and which version? You can try to add indy folder to: "Other unit files" and/or "Include files"(package options).

Abelisto

  • Jr. Member
  • **
  • Posts: 91
Re: How to use an external library in my component?
« Reply #4 on: December 26, 2015, 03:32:09 pm »
Open your package options and click "Show options" button at the bottom. Here you see the options which will be sent to the compiler. Find something like "-Fu../thirdparty/lazarus/comp/Indy10/trunk/Lib/lib/x86_64-linux" there. It is the path to compiled Indy units. If this option is absent then something goes wrong. If it is present then check this directory for files IdHTTP.o and IdHTTP.ppu. If they are absent then something goes wrong. If they are present then... something goes wrong  :-\
OS: Linux Mint + MATE, Compiler: FPC trunk (yes, I am risky!), IDE: Lazarus trunk

safa

  • New Member
  • *
  • Posts: 17
Re: How to use an external library in my component?
« Reply #5 on: December 26, 2015, 06:43:05 pm »
Open your package options and click "Show options" button at the bottom. Here you see the options which will be sent to the compiler. Find something like "-Fu../thirdparty/lazarus/comp/Indy10/trunk/Lib/lib/x86_64-linux" there. It is the path to compiled Indy units. If this option is absent then something goes wrong. If it is present then check this directory for files IdHTTP.o and IdHTTP.ppu. If they are absent then something goes wrong. If they are present then... something goes wrong  :-\

In fact, something is going wrong  :P, the path and the two mentionned files exist. Now it's getting complicated, because I ignore the source of the error.
Quote
@safa
I already tried your suggestion, however when I recompile the component I get the same compilation error.
From where did you install indy and which version? You can try to add indy folder to: "Other unit files" and/or "Include files"(package options).
I downloaded it from Indy website, version: Indy-10.2.0.3 , I also tried your given suggestions before posting my message, but it didn't work  %)
It's never too late, it's never too early, it's always the right moment.

balazsszekely

  • Guest
Re: How to use an external library in my component?
« Reply #6 on: December 26, 2015, 06:55:10 pm »
Indy-10.2.0.3? OMG it's so old, no wondering you have issues with it.

1. Download the components from here: https://drive.google.com/file/d/0B9Me_c5onmWoWWZyZUdtaWlHSzA/view?usp=sharing . Extract indy 10.6.2.0 to lazarus/component folder.
2. Open indylaz.lpk, compile it twice then install once.

safa

  • New Member
  • *
  • Posts: 17
Re: How to use an external library in my component?
« Reply #7 on: December 27, 2015, 10:19:24 am »
Indy-10.2.0.3? OMG it's so old, no wondering you have issues with it.

1. Download the components from here: https://drive.google.com/file/d/0B9Me_c5onmWoWWZyZUdtaWlHSzA/view?usp=sharing . Extract indy 10.6.2.0 to lazarus/component folder.
2. Open indylaz.lpk, compile it twice then install once.
Is it necessary to extract Indy in lazarus component folder? cause I can't find it, (PS: I'm using Debian).
Well,  I compiled it but when I try to install it I get this error: Can't find unit IdAboutVCL used by IdAbout, I tried to add paths to compiler but I'm always getting this error.
It's never too late, it's never too early, it's always the right moment.

balazsszekely

  • Guest
Re: How to use an external library in my component?
« Reply #8 on: December 27, 2015, 02:04:35 pm »
Quote
Is it necessary to extract Indy in lazarus component folder? cause I can't find it, (PS: I'm using Debian).
/usr/share/lazarus/1.x.x/components/
Quote
Well,  I compiled it but when I try to install it I get this error: Can't find unit IdAboutVCL used by IdAbout, I tried to add paths to compiler but I'm always getting this error.
You have to compile it twice then install. I just test it with debian 7.8,  it works fine.

safa

  • New Member
  • *
  • Posts: 17
Re: How to use an external library in my component?
« Reply #9 on: December 29, 2015, 11:42:08 am »
Finally, I could install indy-10.6.2.0, but the error was not relevant to Indy version, I had to add to uses: IdHTTP, however I added: idhttp, as I know pascal is case insensitive language, so I don't know why this just happened, well that's programming: a simple error can cost you a lot of time,  anyway problem is solved.
Again, thanks for your assistance.
PS: How can I make the discussion "solved" ?
« Last Edit: December 29, 2015, 11:44:34 am by safa »
It's never too late, it's never too early, it's always the right moment.

 

TinyPortal © 2005-2018