Recent

Author Topic: TPlaysound problem Ubuntu, Lazarus 4.4  (Read 241 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 764
TPlaysound problem Ubuntu, Lazarus 4.4
« on: June 07, 2026, 08:56:38 pm »
This simple program using the TPlaySound component works fine on my Ubuntu/linux system using Lazarus 4.4

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5.   Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, Dialogs, uplaysound;
  6. type
  7.   { TForm1 }
  8.   TForm1 = class(TForm)
  9.     Button1: TButton;
  10.     playsound1: Tplaysound;
  11.     procedure Button1Click(Sender: TObject);
  12.   private
  13.   public
  14.   end;
  15.  
  16. var
  17.   Form1: TForm1;
  18.  
  19. implementation
  20.  
  21. {$R *.lfm}
  22.  
  23. { TForm1 }
  24.  
  25. procedure TForm1.Button1Click(Sender: TObject);
  26. begin
  27.   playsound1.execute;
  28. end;
  29.  

If I try to use TPlaysound in a different program on the same system but with the following "uses" clause

Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,  lNetComponents, lNet,  uplaysound,;
  3.  

my program fails to compile with the following message:

Quote
Messages, Warnings: 1
Warning: other sources path of package "lnetbase 0.6.6" contains directory "../lib" which is already in the unit search path.
Compile Project, Target: /home/curt/ESPALARM2/project1: Exit code 1, Errors: 1
Main.pas(9,25) Error: Cannot find uplaysound used by Main. Check if package playwavepackage is in the dependencies.

I've tried moving uplaysound to different places in the USES clause with no effect.  Can anyone tell me what I need to do to figure this error out and fix it?

jamie

  • Hero Member
  • *****
  • Posts: 7852
Re: TPlaysound problem Ubuntu, Lazarus 4.4
« Reply #1 on: June 07, 2026, 10:56:52 pm »
Did you do what the message suggested ?

Check the Project:Project Inspector, and include that package in the dependencies list.

jamie

The only true wisdom is knowing you know nothing

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 764
Re: TPlaysound problem Ubuntu, Lazarus 4.4
« Reply #2 on: June 08, 2026, 12:43:36 am »
No, I had forgotten how to respond to the error message  -- but doing it fixed my problem and I can't thank you enough. 

If you have time and some idea, can you explain why I didn't need to add the dependency in the very simple test program, but did in the case of the more complicated USES statement?  I'd like to understand -- but am more than ready to just say thanks again for the help and move on  :)

jamie

  • Hero Member
  • *****
  • Posts: 7852
Re: TPlaysound problem Ubuntu, Lazarus 4.4
« Reply #3 on: June 08, 2026, 12:57:32 am »
I can't answer that directly but can only imagine what you may have done.

 A package is a like a box or paper bag you can just throw things into, in this case unit files that all belong together and many times they are stored on your system in a folder for each package you have installed as unpacked files.

 It's possible you pointed a path to that package folder using the additional path settings in your project, which normally are used to point to some additional files elsewhere for your project.

 Basically, using the Project inspector your project can create a catalog of packages which point to folders that contain the needed associated files.

One step that should be taken and that is, if you archive projects, you should also create a folder in your project folder where you can store the package file of each one you are using for that project that isn't normally installed by default for the IDE.

 This is a way to be able to open your project later on and re-install the package or at least have reference to it.

 Also, if your project is important to you, you could also store the current version of the IDE compressed when you archive it.

Jamie






 
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018