Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-04

Fatal: Cannot find IdMappedPortTCP used by xxxx

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I am again very confused about how Lazarus works.
First I created a GUI program to test TCP port forwarding using the Indy10 component TIdMappedPortTCP. Indy 10 is installed in my Lazarus.

I created a class to encapsulate the functionality and this class uses the IdMappedPortTCP file from Indy.
All went well and now I am trying to move this over to a non-GUI program, so I created a new "Program" in Lazarus and saved it to the same directory as my earlier GUI test.
I also entered the tcpmapper into the program uses clause and proceeded to define a variable of the class in tcpmapper to handle the processing. Lazarus does find tcpmapper, and parses its code.

But now it all breaks down! I can for the life of me not get tcpmapper to pass the compiler even though it did when used from the GUI application!
It complains about not finding IdMappedPortTCP.

I have googled and looked at old list messages but to no avail. The closest I got was someone telling me that Lazarus will handle this fine if only the lpk file is opened once. So I selected File/Open and navigated to the Indy10 installation dir and opened the IndyLaz.lpk file and then closed it. No difference at all! The used unit cannot be found....

So it seems like if one creates a non-GUI application in Lazarus then the packages installed in Lazarus are not available anymore. :( Note:
the Indy10 components are all non-GUI in the first place and I usually always create them in code.

How to solve this?

Bo Berglund Developer in Sweden

Reply by email

Mattias Gaertner
to Bo Berglund
Show quoted text 7 lines
[...] I have googled and looked at old list messages but to no avail. The closest I got was someone telling me that Lazarus will handle this fine if only the lpk file is opened once. So I selected File/Open and navigated to the Indy10 installation dir and opened the IndyLaz.lpk file and then closed it. No difference at all! The used unit cannot be found....

Open it once, so the IDE knows how to resolve a package name (and version) to the location on your disk.

The IDE does not add every known package to every project. Every project has its own list of package requirements. Open the package and click on "Use / Add to project". Or use the Project Inspector to edit the package list.

So it seems like if one creates a non-GUI application in Lazarus then the packages installed in Lazarus are not available anymore. :(

When you drop a component onto a designer form, the IDE automatically adds the package to the project's package list. In a non-GUI project you have to do this step yourself.

Show quoted text 5 lines
Note: the Indy10 components are all non-GUI in the first place and I usually always create them in code. How to solve this?

Mattias

Reply by email

Bo Berglund
to Mattias Gaertner
Mattias Gaertner wrote 13 lines
On Sat, 23 Apr 2016 10:12:33 +0200 Bo Berglund wrote: >[...] > I have googled and looked at old list messages but to no avail. The > closest I got was someone telling me that Lazarus will handle this > fine if only the lpk file is opened once. So I selected File/Open and > navigated to the Indy10 installation dir and opened the IndyLaz.lpk > file and then closed it. No difference at all! The used unit cannot be > found.... Open it once, so the IDE knows how to resolve a package name (and version) to the location on your disk.

Well, that was what I did to start with, but it did not help. Compile still complains.

So what I ended up doing was to go into the Project Options and in Paths added into "Compiler Options/Paths/Other unit files" the following:
../../dev/indy10/Core;../../dev/indy10/Protocols;../../dev/indy10/System

Now the project builds but with this warning:
Warning: other unit files search path (aka unit path) of "MapPort" contains "/home/pi/dev/indy10/Core", which belongs to package "indylaz"

So it seems like for some reason Lazarus now thinks there are two ways to the Indy10 files...

So I removed the entry in the project options shown above and then I compiled again. Now working without me understanding the logic behind it all.

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Mattias Gaertner: On Sat, 23 Apr 2016 10:12:33 +0200 Open it once, so the IDE knows how to resolve a…

This message seems not to have made it to Gmane, so trying again...

Mattias Gaertner wrote 13 lines
On Sat, 23 Apr 2016 10:12:33 +0200 Bo Berglund wrote: >[...] > I have googled and looked at old list messages but to no avail. The > closest I got was someone telling me that Lazarus will handle this > fine if only the lpk file is opened once. So I selected File/Open and > navigated to the Indy10 installation dir and opened the IndyLaz.lpk > file and then closed it. No difference at all! The used unit cannot be > found.... Open it once, so the IDE knows how to resolve a package name (and version) to the location on your disk.

Well, that was what I did to start with, but it did not help. Compile still complains.

So what I ended up doing was to go into the Project Options and in Paths added into "Compiler Options/Paths/Other unit files" the following:
../../dev/indy10/Core;../../dev/indy10/Protocols;../../dev/indy10/System

Now the project builds but with this warning:
Warning: other unit files search path (aka unit path) of "MapPort" contains "/home/pi/dev/indy10/Core", which belongs to package "indylaz"

So it seems like for some reason Lazarus now thinks there are two ways to the Indy10 files...

So I removed the entry in the project options shown above and then I compiled again. Now working without me understanding the logic behind it all.

Bo Berglund Developer in Sweden

Reply by email

Mattias Gaertner
to Bo Berglund
Show quoted text 13 lines
[...] >> I have googled and looked at old list messages but to no avail. The >> closest I got was someone telling me that Lazarus will handle this >> fine if only the lpk file is opened once. So I selected File/Open and >> navigated to the Indy10 installation dir and opened the IndyLaz.lpk >> file and then closed it. No difference at all! The used unit cannot be >> found.... > >Open it once, so the IDE knows how to resolve a package name (and >version) to the location on your disk. Well, that was what I did to start with, but it did not help. Compile still complains.

Yes, as I explained, opening it once allows the IDE to resolve a package name, e.g. "IndyLaz". After that you can use the package name in your project, which is needed for compile.
The package knows the needed compiler flags including the search paths.

Show quoted text 9 lines
So what I ended up doing was to go into the Project Options and in Paths added into "Compiler Options/Paths/Other unit files" the following: ../../dev/indy10/Core;../../dev/indy10/Protocols;../../dev/indy10/System Now the project builds but with this warning: Warning: other unit files search path (aka unit path) of "MapPort" contains "/home/pi/dev/indy10/Core", which belongs to package "indylaz"

Either add the package, or add flags manually. Don't do both.

So it seems like for some reason Lazarus now thinks there are two ways to the Indy10 files...

There are.

So I removed the entry in the project options shown above and then I compiled again. Now working without me understanding the logic behind it all.

Maybe it is not your fault. AFAIK the IndyLaz package is notorious for fail to compile, because the compiler has sometimes trouble resolving its unit dependencies. I will try to get a copy.

Mattias

Reply by email