Recent

Author Topic: Лазарус на MacOS  (Read 10274 times)

Ivan291368

  • New Member
  • *
  • Posts: 10
Лазарус на MacOS
« on: May 27, 2020, 08:13:05 am »
hello everyone why can't I run THE SIMPLEST program? using an online compiler is running but HERE ( https://radikal.ru/video/XaRxCW7F56N) NO
how fix ?

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus on MAcOS
« Reply #1 on: May 27, 2020, 08:35:13 am »
Sorry Ivan, you will need to give us a lot more information about what you are doing.

By "run the simplest program" do you mean compile and run a Lazarus or FPC program on your Mac ? Or are you downloading a program from somewhere and trying to run it ?

Assuming FPC and  or Lazarus, have you installed either of both FPC, Lazarus ?

Do they start up and work as expected ?

If they work, then maybe the source code of your simplest program is the problem, post it here !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Lazarus on MAcOS
« Reply #2 on: May 27, 2020, 08:47:05 am »
Code: Pascal  [Select][+][-]
  1. Program seconds;
  2.  
  3. uses
  4.   crt;
  5.  
  6. var
  7.   rez : longint;
  8.  
  9. begin
  10.   clrscr;
  11.   rez := 60;
  12.  
  13.   writeLn('Seconds in a day: ', rez*24*60);
  14.   writeLn('Seconds in a week: ', rez*24*60*7);
  15.   writeLn('Seconds in a year: ', rez*24*60*365);
  16. end.
  17.  

Compile on the command line with: fpc program.pas

Run the program on the command line with: ./program

Code: Text  [Select][+][-]
  1. Seconds in a day: 86400
  2. Seconds in a week: 604800
  3. Seconds in a year: 31536000

If you want to do this in the Lazarus IDE, then you need to select the correct type of project. It looks like you selected "Application" which is for a GUI program because you have a TForm called Form1. You needed to instead select "Simple Program" which looks like my attachment and compiles and runs without error :)


wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Lazarus on MAcOS
« Reply #3 on: May 27, 2020, 09:12:12 am »
If you can live without a cleared screen, you could also skip the "uses crt" and "ClearScr".

Ivan291368

  • New Member
  • *
  • Posts: 10
Re: Lazarus on MAcOS
« Reply #4 on: May 27, 2020, 09:44:04 am »
Oh, guys, I don't understand. I open in the usual way (in that video I opened via the macOS terminal) and it seems that all settings are reset
in short, what me need edit here ( https://radikal.ru/video/1VERHMKoWyh)  ?
Or tell me what need to do so that the result of executing this code can be displayed on the screen

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Lazarus on MAcOS
« Reply #5 on: May 27, 2020, 10:03:33 am »
1. Start the Lazarus IDE in the normal way from the Applications folder;
2. Choose Project -> New project -> Simple Program;
3. Delete any code in the editor window;
4. Paste in your code (I posted it above) into the editor window;
5. Compile and Run.

If you have trouble doing this, please use the Russian Forum where you can get help in your native language.


Ivan291368

  • New Member
  • *
  • Posts: 10
Re: Lazarus on MAcOS
« Reply #6 on: May 27, 2020, 11:06:56 am »
works but I don't see any results
inserted the code, pressed the green START button and immediately writes that the execution is stopped

Ivan291368

  • New Member
  • *
  • Posts: 10
Лазарус на MacOS
« Reply #7 on: May 27, 2020, 11:12:33 am »
короче, что мне нужно отредактировать здесь ( https://radikal.ru/video/1VERHMKoWyh)?
Или подскажите что нужно сделать чтобы результат выполнения этого кода можно было вывести на экран

на иностранном форуме мне написали так
1. Запустите IDE Lazarus обычным способом из папки приложения;
2. Выберите проект -> Новый проект - > простая программа;
3. Удалить любой код в окне редактора;
4. Вставьте ваш код (я разместил его выше) в окно редактора;
5. Компиляция и запуск.

я сделал, программа запустилась, но не вижу результат, после нажатия на зеленую кнопку СТАРТ пишет что исполнение остановлено

вот код

Program seconds;

var
  rez : longint;
begin
  rez := 60;
  writeLn('Seconds in a day: ', rez*24*60);
  writeLn('Seconds in a week: ', rez*24*60*7);
  writeLn('Seconds in a year: ', rez*24*60*365);
  readln();
end.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Lazarus on MAcOS
« Reply #8 on: May 27, 2020, 12:39:24 pm »
inserted the code, pressed the green START button and immediately writes that the execution is stopped

Make sure you have the "Console" open. A console program will read/write from a shell/terminal, so executing it from a GUI program will show nothing: it'l execute and do its thing but the results will go to "limbo".

In Lazarus select "View->Debug Windows->Console In/Output", as shown in the attached image. Then run your program again and the output will show in the "console" window.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

mig-31

  • Sr. Member
  • ****
  • Posts: 305
Re: Лазарус на MacOS
« Reply #9 on: May 27, 2020, 12:39:28 pm »
Вы создали терминальную программу без графического интерфейса.  Поэтому ее надо запускать из эмулятора терминала (если не ошибаюсь у Мака нет терминала как в Linux/Unix в который можно переключиться через Ctrl+Alt+F<2..12>).

Запускаете эмулятор терминала:
1)  с помощью команды cd переходите в папку проекта и находите бинарный файл имя которого совпадает с названием проекта после слова program; в вашем случае seconds
2) запускаете бинарный файл ./<имя файла>; в вашем случае ./seconds

Команда ls отображает содержание папки.



 
« Last Edit: May 27, 2020, 12:41:00 pm by mig-31 »
Lazarus 2.2.6 - OpenSuse Leap 15.4, Mageia 8, CentOS 7

Ivan291368

  • New Member
  • *
  • Posts: 10
Re: Lazarus on MAcOS
« Reply #10 on: May 27, 2020, 03:16:46 pm »
Hmm I don't have this function
there is no combination of the key with the letter O

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus on MAcOS
« Reply #11 on: May 27, 2020, 04:39:36 pm »
Никогда не ставь "целевая ось" как "macos"
твоя целевая ось это "darwin"

про CPU "i386" тоже неплохо было бы забыть.  Начиная с Каталины будет работать только  "x86_64"

а чтобы увидеть окошко вывода, добавь перед readln(); перед end.
« Last Edit: May 27, 2020, 04:41:25 pm by skalogryz »

Ivan291368

  • New Member
  • *
  • Posts: 10
Re: Lazarus on MAcOS
« Reply #12 on: May 27, 2020, 08:40:17 pm »
In response to the Russian man
Все равно не так
Да, сначала новый файл потом простая программа но все равно не получается
без изменений
https://radikal.ru/video/tGDPzkwty4i
с "darvin"
https://radikal.ru/video/VCbeIBBH0KN
с "x86_64"
https://radikal.ru/video/TTWHyaqwI0c
про выбор "dwaft-3" взял с инета туториала
Вы меня слышишь ? Просто кажется, что я неправильно отвечаю
for all
Do you hear me answering you? If I don't answer correctly, tell me how to do it. just the first time on the site

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Лазарус на MacOS
« Reply #13 on: May 27, 2020, 09:14:57 pm »
слил обе темы в одну.

на последнем видео, ты показываешь, что выбираешь настройки Darwin в параметрах сборки лазаруса. Это не то чтобы плохо, но это твоему проекту не поможет.

Чтобы сделать настройки проекта, нужно смотреть меню "Проект"->"Параметры Проекта"

попробуй вот что сделать - запустить проект БЕЗ отладчика.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 486
Re: Лазарус на MacOS
« Reply #14 on: May 27, 2020, 09:28:57 pm »
Вообще, странно, что ТС в качестве "простейшей программы" пытается запустить консольный проект. Может, стоит попробовать классический "Hello, World!"?

И ещё пожелание, выкладывать скрины аттачем, чем постить видео на русском ресурсе (не знаю, как они открываются у зарубежных участников форума).
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

 

TinyPortal © 2005-2018