Recent

Author Topic: error  (Read 1000 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16199
  • Censorship about opinions does not belong here.
Re: error
« Reply #15 on: November 10, 2024, 06:09:19 pm »
Just like I wrote, type section
Code: Pascal  [Select][+][-]
  1. type  // you need to repeat that if you declare a new type after implementation from others.
  2.  SensorItem = record
  3.             naam      : string;
  4.             hoogte    : real;
  5.             breedte   : real;
  6.             crop      : real;
  7.             end;
A type is not a var.....
Do you understand it now? because that is a basic mistake.

« Last Edit: November 10, 2024, 06:10:55 pm by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

rvk

  • Hero Member
  • *****
  • Posts: 6591
Re: error
« Reply #16 on: November 10, 2024, 06:13:22 pm »
The actual problem is here:

Code: Pascal  [Select][+][-]
  1.   TPhoto = class(TCamera)
  2.  
  3.   var
  4.     //  focusdistance : real;
  5.  
  6.   private

You commented out focusdistance.
But that variable is the ONLY one in the var section.
So you also need to comment out the var keyword itself otherwise you are still in the var section when the code continues.

/edit/ Mmmmm. It seems that an empty var is accepted by the compiler.

@georgje can you do the following.
In Lazarus choose Project > Publish project.
Choose a destination directory and remove the "res" from the filter.
Then click ok. It will create a zip with all the relevant files.
Attach it to a post here.

/edit 2/ Rats. I see .res is always included. Grrrr. If the zip is too large, please remove the .res manually.
« Last Edit: November 10, 2024, 06:19:21 pm by rvk »

georgje

  • New Member
  • *
  • Posts: 12
Re: error
« Reply #17 on: November 10, 2024, 06:36:00 pm »
I'm not used to this forum software. I don't know how to reply to a certain post.
The type is Record and that contains varaibles.

georgje

  • New Member
  • *
  • Posts: 12
Re: error
« Reply #18 on: November 10, 2024, 06:52:31 pm »
How can I reply to a post?

440bx

  • Hero Member
  • *****
  • Posts: 4749
Re: error
« Reply #19 on: November 10, 2024, 06:59:00 pm »
How can I reply to a post?
Click on "quote", this will open an editing box with the post's text quoted.  Edit the quoted text if necessary (usually by removing text, not adding nor modifying anything in it.)

Also, you can quote multiple posts by clicking on "insert quote" (which you'll see only after you are editing your new post.)

To summarize:

1. click on "quote"
2. edit text to your liking
3. click on "Insert quote" to quote additional posts
4. edit text to your liking
5. click "post" when you're satisfied with your text

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4749
Re: error
« Reply #20 on: November 10, 2024, 07:05:05 pm »
Photo.lpr is empty.  It should not be empty.  That's why the compiler is complaining about a "begin" missing.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

rvk

  • Hero Member
  • *****
  • Posts: 6591
Re: error
« Reply #21 on: November 10, 2024, 07:05:31 pm »
You photo.lpr is 0 bytes.
It contains nothing.
It should contain the basis of your project.

If you can't find the correct source, then you need to recreate the base project.

Create a new project and save it in a new folder. Then close the project and copy unit1.* and camera.* in the new folder (overwriting the current unit1.*).
After reopening the project, it should at least contain the correct unit1.* and be compilable.

VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: error
« Reply #22 on: November 10, 2024, 07:16:43 pm »
The attached project has been corrected and fixed: the mess in the project configuration file (LPI) and the project file (LPR) as well as errors in the PAS module of the program window (no conversion from Real to String).

georgje

  • New Member
  • *
  • Posts: 12
Re: error
« Reply #23 on: November 10, 2024, 07:26:02 pm »
You photo.lpr is 0 bytes.
It contains nothing.
It should contain the basis of your project.

If you can't find the correct source, then you need to recreate the base project.

Create a new project and save it in a new folder. Then close the project and copy unit1.* and camera.* in the new folder (overwriting the current unit1.*).
After reopening the project, it should at least contain the correct unit1.* and be compilable.

That worked.I had also copy the form. But now I get understandable warnings. Thanks.
Leaves me with the question why that file was empty.

VisualLab

  • Hero Member
  • *****
  • Posts: 575
Re: error
« Reply #24 on: November 10, 2024, 07:44:44 pm »
Leaves me with the question why that file was empty.

Only you know the answer to this question. Maybe you accidentally deleted or moved something (after selecting the file content) and then saved the changes to the original file.

 

TinyPortal © 2005-2018