Lazarus

Using the Lazarus IDE => Editor => Topic started by: vonda on March 30, 2023, 01:54:34 pm

Title: [Solved] Fatal: Cannot open include file "daemonapp.inc"
Post by: vonda on March 30, 2023, 01:54:34 pm
Hi,
I am new to Lazarus and Freepascal. I am trying to make a service following this: https://wiki.freepascal.org/Daemons_and_Services (https://wiki.freepascal.org/Daemons_and_Services)

I downloaded the source code. But when I try to build "TestDaemonCodeOnly", I get error:
Code: Pascal  [Select][+][-]
  1. Compile Project, Mode: Release, Target: x86_64-win64\Release\TestDaemonCodeOnly.exe: Exit code 1, Errors: 1
  2. daemonapp.pp(461,2) Fatal: Cannot open include file "daemonapp.inc"

I have Windows 11, I have installed the lazdaemon package and I have added the folder with "daemonapp.inc" file into Project options -> Paths -> Other unit files.

Can you please suggest what can be wrong?
Title: Re: Fatal: Cannot open include file "daemonapp.inc"
Post by: marcov on March 30, 2023, 03:15:38 pm
You included the FPC source directory into your unit path, or you have a duplicate daemonapp.pp somewhere.

Standard, FPC uses precompiled files rather than source directories.
Title: Re: Fatal: Cannot open include file "daemonapp.inc"
Post by: wp on March 30, 2023, 03:40:37 pm
I have Windows 11, I have installed the lazdaemon package and I have added the folder with "daemonapp.inc" file into Project options -> Paths -> Other unit files.
Did you add the lazdaemon package to the requirements of the project (Project options, "Add" > "New requirement" > select "lazdaemon" in the packages listbox > "OK")? In Lazarus, access to libraries is made via packages, not by extending the unit search path like in Delphi - leave the "Paths" > "Other units files" alone unless you know what you are doing or you structured your project files in subdirectories. After fixing this, do a "Run" > "Build" in order to delete the project output directory from the previous compilation attempts.
Title: Re: Fatal: Cannot open include file "daemonapp.inc"
Post by: vonda on March 31, 2023, 08:22:54 am
Thank you very much, for your help.

Adding the package as requirement and removing everything from "Other units" paths helped.

Just for anyone facing the same problem, the requirements can be set in Project -> Project Inspector... -> Add -> New requirement.
TinyPortal © 2005-2018