Recent

Author Topic: Errors writting source code - Lazarus 1.6.4  (Read 5271 times)

PsaCrypt

  • New Member
  • *
  • Posts: 21
Errors writting source code - Lazarus 1.6.4
« on: June 08, 2017, 12:01:12 pm »
Hello to all members,

recently I updated to Lazarus 1.6.4 and FPC 3.0.2, moving my source code from other programing language.  OS is Linux Mint 17.3.  I found next errors in Lazarus IDE:

1)  I can not create my own functions within IDE editor.  After added new module or form, created my own functions and compiling the project, compiler shows me error "expected end.".  Dot after end means end of program.  Within source code, function structure is a " begin ... end;" block.  IDE editor only allows me to create only one own function in new module or form.  Very sad.  :-(

2)  Lazarus IDE haves error in "save" and "save as ..." file options.  Error showed is about file access.  To create a new project and save it right, I only can do startlazarus, create new project, and push command button "save all".  This is the only way.

Could be solved these errors?

Thank you.

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Errors writting source code - Lazarus 1.6.4
« Reply #1 on: June 08, 2017, 01:10:31 pm »
You said you recently updated your Lazarus/FPC. Do the issues happen on Lazarus 1.6.4 and FPC 3.0.2 only or also on other versions?

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Errors writting source code - Lazarus 1.6.4
« Reply #2 on: June 08, 2017, 02:14:17 pm »
More Information please.

What does your code look like ?
What do you want it to look like ?

Be verbose !!
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

PsaCrypt

  • New Member
  • *
  • Posts: 21
Re: Errors writting source code - Lazarus 1.6.4
« Reply #3 on: June 08, 2017, 03:34:34 pm »
Hello Handoko, error number #2 is present in Lazarus 1.6 with FPC 3.0.  These errors are not founded in Delphi compiler IDE, but Delphi is Windows and I do not have that OS in my computers.  I love xBase compilers.  I found errors in stable release Harbour 3.0, losing variable values.  This is the reason I choose to move all my source code from Harbour and Delphi to FPC.  Edit added:  before Lazarus 1.6.4 I don't use Lazarus 1.6 for daily use, only used for testing some things.  Error number #1 was not tested in Lazarus 1.6.

Jc99, error number #1 is found creating your own functions within a new module.  I don't have Lazarus/FPC in this device (Android).  Create new Lazarus project, add a empty source code module, declare functions like next sample ...


Function myfunc1: boolean;
Function myfunc2: boolean;


Write some commands on these functions like next ...


Function myfunc1(): boolean;
Begin

...

End;

Function myfunc2(): boolean;
Begin

...

End;


Save your project and try to compile it.  Compilation of myfunc1() success right, but compilation of myfunc2() returns error.  Expected "end." Instead of "end;".

:-(
« Last Edit: June 08, 2017, 03:41:32 pm by PsaCrypt »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Errors writting source code - Lazarus 1.6.4
« Reply #4 on: June 08, 2017, 03:45:03 pm »
Your code contains syntax error, somewhere we can only guess. Your end; already exists somewhere, hence the parser is expecting end, which it doesn't then throw that error.

sky_khan

  • Guest
Re: Errors writting source code - Lazarus 1.6.4
« Reply #5 on: June 08, 2017, 04:04:44 pm »
#1 Most probably you have one or more extra "end;" than "begin"s in your source.
#2 You should save your projects/units in a folder where you have full access rights like in your home or documents folder, depends on OS you use.

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Errors writting source code - Lazarus 1.6.4
« Reply #6 on: June 08, 2017, 04:13:33 pm »
@PsaCrypt

Lets try my step-by-step to start a new project, create new procedure and save:

01. Start your Lazarus.

02. Lazarus main menu > File > Close All.
This step 02 is needed to make sure you 'really' start Lazarus fresh, not opening previous files.

03. Lazarus main menu > File > New > Project > Application > Press "OK" button.

04. On the Source Editor, move your caret (text cursor) to line #20, press Enter and then press Home.

05. Type "procedure SayHello;" and Enter.

06. Press ArrowUp, so now your caret should be on line #21.

07. Press Ctrl+Shift+C, now some codes will be appeared automatically.

08. You now should be on line #27. Type "ShowMessage('Hello');"

09. Lazarus main menu > Run > Compile.
This process should not show any error or warning message.

10. Lazarus main menu > File > Save All > Provide a name (the default is Project1.lpi) > Choose the location you want > Press "Save" button.

11. It will then ask for the unit name (the default is unit1.pas). Rename it or use the default then press "Save" button.

Try my steps above. If you manage to follow to step 11 without problem, then well done you have created a procedure (SayHello), compiled and saved them correctly. Creating functions are similar.

« Last Edit: June 08, 2017, 04:26:04 pm by Handoko »

PsaCrypt

  • New Member
  • *
  • Posts: 21
Re: Errors writting source code - Lazarus 1.6.4
« Reply #7 on: June 08, 2017, 05:01:59 pm »
Ufffffffffff ... sorry to all.

I was wrong.  Error number #1 is solved.  I was converting a xBase funcion to Lazarus and forget to include "begin" in a "if...then" structure.  Now runs fine.  :-)

Handoko, I started Lazarus fresh.  "Save all" command button is the only right way to save new project.  If you choose "file > save" or "file > save as ..." You got error accessing file.

At this moment only error number #2 is present.

Thank you.  :-)

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Errors writting source code - Lazarus 1.6.4
« Reply #8 on: June 08, 2017, 05:30:33 pm »
I have no problem to use save as. Try these steps:

01. Start your Lazarus.

02. Lazarus main menu > File > Close All.

03. Lazarus main menu > File > New > Project > Application > Press "OK" button.

04. Lazarus main menu > File > Save As > Provide a name (the default is Project1.lpi) > Choose the location you want > Press "Save" button.

05. It will then ask for the unit name (the default is unit1.pas). Rename it or use the default then press "Save" button.

Can you follow it to step 05 without error? Maybe the location you want to save to is protected, try to use other location.

PsaCrypt

  • New Member
  • *
  • Posts: 21
Re: Errors writting source code - Lazarus 1.6.4
« Reply #9 on: June 08, 2017, 07:34:07 pm »
Steps 1 to 3 ok.  Step 4 error: access violation.  Choosed folder to save new application project is /home/mint, not restricted to read/write.  From terminal ...

Tcustomformeditor.jitlistexception list.curreadstreamclass=nil nil
Tapplication.handleexception: there was another exception during showing the first exception

Stack trace:
$0814b3e3
...
... 15 more numbers to stack trace ...
...
$08297d17
Lazarus.pp - unhandled exception

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Errors writting source code - Lazarus 1.6.4
« Reply #10 on: June 08, 2017, 08:01:56 pm »
I heard some issues about Linux Mint + Lazarus in this forum. I didn't follow those threads, you can search for them if you want.

I use Ubuntu Mate, I experience some minor issues only, none of them are critical. Perhaps you can install VirtualBox and try Lazarus on other Linux distros.

The issue you got is a serious problem, it should receive more attentions.
« Last Edit: June 08, 2017, 08:11:09 pm by Handoko »

PsaCrypt

  • New Member
  • *
  • Posts: 21
Re: Errors writting source code - Lazarus 1.6.4
« Reply #11 on: June 08, 2017, 09:38:08 pm »
Handoko, before using Linux Mint I used Ubuntu.  I changed to Linux Mint Mate because system resources are more clean.  Ubuntu is changing like an old windows, too much memory.  My base plattform will be always i386 with 512mb, 1gb or 2gb RAM capacity.  This always run and have running all my software previously used in Ubuntu.  My Linux Mint is owned remaster.  :-)

 

TinyPortal © 2005-2018