Using Geany in Linux - Screen shot plz

New to FreeBASIC? Post your questions here.
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Using Geany in Linux - Screen shot plz

Post by tone »

Hi,

It's good to be back after 11 years. Interesting to see what's changed since '08. Thought I still remembered my old Freebasic login, but apparently not. From what I recall Freebasic had a great community and I expect it's what I'll teach my children when they start programming.

So, I'm new to Linux, quite new; first proper exposure was from Raspberry pi, now I'm trying MX Linux as per the decline of Microsoft (Win 7 support).

In fact I haven't done much programming at all in the last 5 years. Last I was using Dev-C++ I think.

I've installed the Freebasic compiler but I don't know how to link it to the Geany IDE.

Anyway, can someone please provide a screen snip of their Geany build manager for a debian distro? Like the configuration pictures shown here:
https://wiki.geany.org/howtos/configurebuildmenu

Also an explanation of what the "%f" "%e"'s do would also be appreciated.

Thanks in advance,

R
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Using Geany in Linux - Screen shot plz

Post by badidea »

Welcome back. Posts of 'new' users don't show up in 'new posts'.

Anyway, example settings (on Ubuntu Mate):
Image
Keys: F8 or F9 (for compile) and F5 (run).

And, some experimental 'compile + run' in one go:
Image
Here also, F8 for the 32-bit compiler, and F9 for the 64-bit compiler.
I renamed fbc in /usr/local/bin for this.

And for the %f %e: https://www.geany.org/manual/current/in ... irectories
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

Thanks for the brilliant reply!

Bloody hell, the Freebasic manual is almost two and a half thousand pages. Okay, my comprehension is very rusty. The Geany building manager configuration section says its substituting with the name of the current file?

I'm a bit confused, where is the path coming from, the location of the current .bas file?

so the absolute path of your fbc compiler is: fbc in /usr/local/bin?

Are you saying you renamed the 32bit and 64 bit compilers in here?

Sorry, I'm a little slow...

Cheers,
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Using Geany in Linux - Screen shot plz

Post by TJF »

tone wrote:I'm a bit confused, where is the path coming from, the location of the current .bas file?
Geany manual wrote: %d - substituted by the absolute path to the directory of the current file.
%e - substituted by the name of the current file without the extension or path.
%f - substituted by the name of the current file without the path.
%p - if a project is open, substituted by the base path from the project.
%l - substituted by the line number at the current cursor position.
tone wrote:so the absolute path of your fbc compiler is: fbc in /usr/local/bin?
Note. Geany uses by default the system shell to start this commands, which is /bin/sh. This shell may have another $PATH setting than your terminal shell (/bin/bash). So it's best practise to enter commands with full path here.

In order to find your fbc location enter in a terminal

whereis fbc

Regards
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

TJF wrote:
tone wrote:
whereis fbc
A very nice trick. I think I'm getting it now, so fbc is the file containing the compiler, but how does just by writing 'fbc' (or gcc for that matter) point the IDE to it? Does Geany do a similar search as 'whereis' when you compile?

This is embarrassing, but is there an even more dumbed-down explanation than:
%d - substituted by the absolute path to the directory of the current file.
%e - substituted by the name of the current file without the extension or path.
%f - substituted by the name of the current file without the path.
%p - if a project is open, substituted by the base path from the project.
%l - substituted by the line number at the current cursor position.

I'm still not comprehending the 'Label': "compile"/"release" or the 'commands'. (I was also surprised to see the 'Working Directory' empty, I though they'd have to have the library location or something written in them.

Thanks for all the help
Last edited by tone on Dec 19, 2019 11:51, edited 1 time in total.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Using Geany in Linux - Screen shot plz

Post by TJF »

tone wrote:... but how does Linux know what 'fbc' (or 'gcc', which I just tried) is, was it part of when I did the './install.sh -i'?
fbc is the name of an executable on your HDD. Linux searches all directories in $PATH to find it. You may have multiple executables called fbc in different folders. In that case whereis lists multiple path/names.
tone wrote:This is embarrassing, but is there an even more dumbed-down explanation than ...
Just click the link in the quote-box (the text "Geany manual").
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

TJF wrote:
tone wrote:... but how does Linux know what 'fbc' (or 'gcc', which I just tried) is, was it part of when I did the './install.sh -i'?
fbc is the name of an executable on your HDD. Linux searches all directories in $PATH to find it. You may have multiple executables called fbc in different folders. In that case whereis lists multiple path/names.
tone wrote:This is embarrassing, but is there an even more dumbed-down explanation than ...
Just click the link in the quote-box (the text "Geany manual").
I know that this is a freebasic forum, not a linux forum, but I have to ask: I thought everything was a file in linux, so what is an 'executable'? Like a shell?
I have to apologise for my fundamental ineptitude with Linux making a bad situation worse.

I think I'll have to look for a more elaboratory tutorial on $PATH, I just read that it's an "environmental" variable (not sure what environmental means, like operating system variable?) which stores directories for you to use, but as to the specifics on how I'm still vague. I assume when I initiated the install shell it populated fbc in $PATH.

I don't mean to sound like a petulant ingrate when I say this, but when I read the aforementioned "Geany manual" text I still don't understand it, I need an example of why the substitutions are necessary I think etc. I'm not asking anyone to hold my hand and explain it to me though, I'll do more research tomorrow. I need to find the time to look into it more deeply.

Similarly, are: -w -s gui all -exx
freebasic related, or Geany related? (Because I need to find out what they do.)

Thanks again!
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Using Geany in Linux - Screen shot plz

Post by badidea »

tone wrote:I know that this is a freebasic forum, not a linux forum, but I have to ask: I thought everything was a file in linux, so what is an 'executable'? Like a shell?
A file is an executable when the execute bit is set. When doing an ls -l (list files), you might see this:

ls -l /usr/local/bin/fbc
-rwxr-xr-x 1 root root 1502848 Dec 16 20:14 /usr/local/bin/fbc


The x means executable. There are 3 x for file owner, 1 for group, 1 for all else.
tone wrote:I think I'll have to look for a more elaboratory tutorial on $PATH, I just read that it's an "environmental" variable (not sure what environmental means, like operating system variable?) which stores directories for you to use, but as to the specifics on how I'm still vague. I assume when I initiated the install shell it populated fbc in $PATH.
You can show the value with:

echo $PATH
/home/badidea/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin


Environment variables are also used on Windows (and DOS if I remember well): https://en.wikipedia.org/wiki/Environment_variable
tone wrote:Similarly, are: -w -s gui all -exx
freebasic related, or Geany related? (Because I need to find out what they do.)
All freebasic compile options, see: https://freebasic.net/wiki/wikka.php?wakka=CatPgCompOpt

To compile: Geany calls fbc, adds these options and adds the current file open, e.g: fbc -exx hello.bas
To run: Geany calls ./hello (so with the .bas stripped). This file was created (with the execute bit set) by fbc in the previous step (unless there was a compile error).
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

Hi,

Ah I remember watching a video where he discussed "-rwxr-xr-x", on youtube about 12 months ago.

So they're like the properties of the file which you can change? Vary the 'x' (if executable) and who has permission to see it, access it etc.?

Can I just make a new project "untitled" no template, no .bas extension and build it? Or do I need to set it up as a project as a .bas?
I did this and just saved 'untitled' in documents directory.

So when I go to compile using command: 'fbc -exx -w all "%f"

I get an invalid command line option. error 81.

Out of interest when I remove the -w all "%f", it still fails to compile (as one would expect). When I also add ; "./%e"
Then I also get "/bin/sh: 1: ./untitled: Permission denied"


Edit:

I just renamed as untitled.bas and I think that solved one issue, but the next issue is that the compiler says: ld: cannot find -lncurses compilation failed
Xusinboy Bekchanov
Posts: 793
Joined: Jul 26, 2018 18:28

Re: Using Geany in Linux - Screen shot plz

Post by Xusinboy Bekchanov »

tone wrote:Hi,
Edit:

I just renamed as untitled.bas and I think that solved one issue, but the next issue is that the compiler says: ld: cannot find -lncurses compilation failed
Open up your terminal and install libncurses-dev by using this command:

Code: Select all

sudo apt-get install libncurses-dev
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

"Hello World!"
Sleep

Thanks very much!

Final dumb question: in the folder where I compiled and built the .bas, there is an 'executable', but when I click it, it doesn't run, the only way I can get it to run is by clicking the run icon in Geany. How do it get it to run either by clicking it or in the terminal?

Thanks again!
Xusinboy Bekchanov
Posts: 793
Joined: Jul 26, 2018 18:28

Re: Using Geany in Linux - Screen shot plz

Post by Xusinboy Bekchanov »

tone wrote:Final dumb question: in the folder where I compiled and built the .bas, there is an 'executable', but when I click it, it doesn't run, the only way I can get it to run is by clicking the run icon in Geany. How do it get it to run either by clicking it or in the terminal?

Thanks again!
In order to see the result of the program, you need to run the terminal, from the terminal run the program
badidea
Posts: 2594
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Using Geany in Linux - Screen shot plz

Post by badidea »

tone wrote:Final dumb question: in the folder where I compiled and built the .bas, there is an 'executable', but when I click it, it doesn't run, the only way I can get it to run is by clicking the run icon in Geany. How do it get it to run either by clicking it or in the terminal?
It does run, but you don't see the output (and probably keeps running until killed).
For graphics programs (using screen / screenres), you will get to see something.
You are not the first who runs into this problem. See e.g.: https://freebasic.net/forum/viewtopic.php?f=5&t=27225
tone
Posts: 26
Joined: Dec 17, 2019 21:31

Re: Using Geany in Linux - Screen shot plz

Post by tone »

Hi,

Ah the mistake I was making was not including './' because I opened the terminal from the directory with the file I thought it would work, but evidently it still needed to specify it because it's not in the $PATH.

Gee, I haven't thought of 'screen' for ages, reminds me of Qbasic. Okay, so if I have -s gui in the compile and run, however now I'm getting the compiler error: ld: cannot find -lXpm and cannot find: -lXrandr and cannot find -lXrender, when I try to use screen 12 in the code.

Is this the same situation as with libncurses, and I need to install these the same way?

I am really excited by linux, but I wish I grew up with it, because (I'm going on 30 yo) and a lot of the basics I read 8 months ago and I have totally forgotten. Its hard when you have extreme time constraints.

Thanks again!!
Xusinboy Bekchanov
Posts: 793
Joined: Jul 26, 2018 18:28

Re: Using Geany in Linux - Screen shot plz

Post by Xusinboy Bekchanov »

tone wrote:Hi,

Ah the mistake I was making was not including './' because I opened the terminal from the directory with the file I thought it would work, but evidently it still needed to specify it because it's not in the $PATH.

Gee, I haven't thought of 'screen' for ages, reminds me of Qbasic. Okay, so if I have -s gui in the compile and run, however now I'm getting the compiler error: ld: cannot find -lXpm and cannot find: -lXrandr and cannot find -lXrender, when I try to use screen 12 in the code.

Is this the same situation as with libncurses, and I need to install these the same way?

I am really excited by linux, but I wish I grew up with it, because (I'm going on 30 yo) and a lot of the basics I read 8 months ago and I have totally forgotten. Its hard when you have extreme time constraints.

Thanks again!!
By default, you need to install these dependencies:

Code: Select all

# sudo apt-get install gcc g++ libncurses5-dev libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev
Post Reply