Recent

Author Topic: install Packages: same filenames (*.pas)  (Read 3876 times)

in0k

  • New Member
  • *
  • Posts: 16
install Packages: same filenames (*.pas)
« on: May 05, 2016, 09:38:02 am »

There are two package NewPackage01.lpk, NewPackage02.lpk.
In each of them there is a file UnitTest.pas (for each package is different, only the names are the same).

When i try to install BOTH packages, i receive the error:

Code: [Select]
Ambiguous units found
There are two units with the same name:
1. "...\testLPK\test2\UnitTest.pas" from NewPackage02 0.0
2. "...\testLPK\test1\UnitTest.pas" from NewPackage01 0.0
Both packages are connected. This means, either one packages uses the other, or thew are both used by a third package.

is there a way to get around this?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: install Packages: same filenames (*.pas)
« Reply #1 on: May 05, 2016, 10:20:40 am »
Rename one of the UnitTest.pas files?

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: install Packages: same filenames (*.pas)
« Reply #2 on: May 05, 2016, 10:27:29 am »
It is a good practice to give all files of the same package a common prefix unique to the package. In TAChart (package TAChartLazarusPkg), for example, all unit names begin with TA. This way the probability that two units have the same name is greatly reduced.

in0k

  • New Member
  • *
  • Posts: 16
Re: install Packages: same filenames (*.pas)
« Reply #3 on: May 05, 2016, 10:40:32 am »
It is a good practice to give all files of the same package a common prefix unique to the package. In TAChart (package TAChartLazarusPkg), for example, all unit names begin with TA. This way the probability that two units have the same name is greatly reduced.
why?

path for *.pas file is different, path for *.ppu file is different!

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: install Packages: same filenames (*.pas)
« Reply #4 on: May 05, 2016, 01:49:18 pm »
why?

path for *.pas file is different, path for *.ppu file is different!

When you include UnitTest.pas in your project how it will know from which package it'll take that unit ?

in0k

  • New Member
  • *
  • Posts: 16
Re: install Packages: same filenames (*.pas)
« Reply #5 on: May 05, 2016, 02:30:50 pm »
logically!!!

I didn't think about that :-(

in0k

  • New Member
  • *
  • Posts: 16
Re: install Packages: same filenames (*.pas)
« Reply #6 on: May 06, 2016, 08:24:03 am »
When you include UnitTest.pas in your project how it will know from which package it'll take that unit ?

by Required in project? or order in Required, or nameSpase  ;)
Code: Pascal  [Select][+][-]
  1. ...
  2. uses NewPackage01.UnitTest;
  3. ...
  4.  

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: install Packages: same filenames (*.pas)
« Reply #7 on: May 06, 2016, 05:36:06 pm »
Delphi namespaces change the unit name too, just to something with a dot in it :-)

 

TinyPortal © 2005-2018