Geany to compile FB source code on Windows?

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Geany to compile FB source code on Windows?

Post by BasicCoder2 »

With FBIDE I go to View>Settings to get a FBIde settings window and there is a FreeBASIC tab but can't find anything the same with the Geany editor.

Image

I have Geany installed and it fires up to run Python code although I have been using the IDLE Shell for writing Python code. I forget installing Geany but in properties it says it was created 27thJan2021. I used Geany on the RPi to write FreeBASIC programs but forget now how I set it up.

The question is: How can Geany on windows be set up to compile and run FreeBASIC source code and will this remove its ability to run Python code?
Last edited by BasicCoder2 on Sep 12, 2021 7:58, edited 1 time in total.
fxm
Moderator
Posts: 12098
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Geany to compile FB on Windows?

Post by fxm »

First open a file with the '.bas' extension.
Then fill in the 'Commandes pour FreeBasic' from the menu 'Construire / Définir les commandes de construction':

Image

Image

This only adds commands for the FreeBASIC files (identified by the *.bas type).
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Geany to compile FB source code on Windows?

Post by BasicCoder2 »

Thanks fxm. I am always fearful that changing things without understanding will end up getting it completely non functional.
While looking for how to get to that window I ended up doing this and it set it up for me.
The FreeBASIC example compiled and ran ok.
Image
srvaldez
Posts: 3377
Joined: Sep 25, 2005 21:54

Re: Geany to compile FB source code on Windows?

Post by srvaldez »

@BasicCoder2
remember that Geany is a multi-language IDE, if you open a file with a .py extension it will try to invoke python when you click on execute
if you have .bas file open then when you click on compile it will try to launch fbc and compile the program
some of the menu options will change depending on what type of file is currently open, for the following you need to have a bas file open
between the Build and Execute buttons there's a drop-down menu, click on it and select Set Build Commands
there you can add the full path of fbc and your favorite compiler options, mine looks like this
D:\dev1\FreeBASIC-1.09.0-win-gcc-9.3\fbc64 -asm intel -t 2048 -w all -arch native -gen gcc -Wc -O2 -v "%f"
if you have a C file open then the Set Build Commands will have different default values, you can change it according to your paths and desired options
for C and gfortran programs for example you need to Build the program not simply compile, then after Building you may execute the program if the build was successful
fxm
Moderator
Posts: 12098
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Geany to compile FB source code on Windows?

Post by fxm »

If you know Geany well, could you tell me how I could configure it to force the English language?

This works by launching Geany from a '.bat' file:

Code: Select all

set LANG=English
start GeanyPortable.exe
But maybe there is better?
badidea
Posts: 2589
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Geany to compile FB source code on Windows?

Post by badidea »

On Windows, you can define an environment variable "LANG" and set to "en" or "fr".
See also: https://www.geany.org/documentation/faq ... -interface

At work we have Geany installed on a bunch of computers, all Windows in English, but Geany decides to use Dutch anyway, unless you do the above. Very annoying.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Geany to compile FB source code on Windows?

Post by dodicat »

I dowloaded geany, expanded it and ran it on my Win 10, but I give up.
How do I set my compiler path?
I get (under status)
fbc -w all "testgeany.bas" (in directory: C:\Users\Computer\Desktop\fb\code)

If fbc.exe was on the system path maybe it would work, but I would never put fbc.exe on the system path, I always use both 64 and 32 bit.
It looks very pretty, It got the syntax looking OK, but I see no quick run either.
It says a lightweight ide (at 94 Megabytes??)
So many programming and script languages to weigh it down.
This geany is going back in the lamp.
Basiccoder2, under your geany picture I note blob stuff, blob area/perimiter, looks interesting, what is it all about?
srvaldez
Posts: 3377
Joined: Sep 25, 2005 21:54

Re: Geany to compile FB source code on Windows?

Post by srvaldez »

dodicat, read my post above
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Geany to compile FB source code on Windows?

Post by dodicat »

Thanks srvaldez.
I'll try that.
Meanwhile I put a stub in my mingw/bin folder which is on path.
fbc.bas

Code: Select all


dim as string args

for n as long=1 to 15
    args+=command(n) +" "
next n
exec("C:\Users\Computer\Desktop\fb\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\fbc64.exe ", args)
 
it works fine now, I can have up to 15 command line options.
...
fbc -Wc -O3 "testgeany.bas" (in directory: C:\Users\Computer\Desktop\fb\code)
Compilation finished successfully.
...

I miss the search in the open file dialog, and the quick run.
I'll try freepascal later.
Thanks.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Geany to compile FB source code on Windows?

Post by TJF »

I just updated the keywords (for syntax highlighting) to the list in the current documentation. Perhaps someone is interested

Code: Select all

[keywords]
# all items must be in one line
keywords=abs abstract access acos add alias allocate alpha and andalso any append as assert assertwarn asc asin asm atan2 atn base beep bin binary bit bitreset bitset bload boolean bsave byref byte byval call callocate case cast cbool cbyte cdbl cdecl chain chdir chr cint circle class clear clng clngint close cls color com cons command common condbroadcast condcreate conddestroy condsignal condwait const constructor continue cos cptr cshort csign csng csrlin cubyte cuint culng culngint cunsg curdir cushort custom cva_arg cva_copy cva_end cva_list cva_start cvd cvi cvl cvlongint cvs cvshort data date dateadd datediff datepart dateserial datevalue day deallocate declare defbyte defdbl defint deflng deflongint defshort defsng defstr defubyte defuint defulongint defushort delete destructor dim dir do double draw dynamic dylibfree dylibload dylibsymbol else elseif encoding end endif enum environ escape eof eqv erase erfn erl ermn err error event exec exepath exit exp explicit export extends extern false fb_memcopy fb_memcopyclear fb_memmove fbarray fboolean field fileattr filecopy filedatetime fileexists fileflush filelen fileseteof fix flip for format frac fre freefile function get getjoystick getkey getmouse gosub goto  hex hibyte hiword hour  if iif imageconvertrow imagecreate imagedestroy imageinfo imp implements import inkey inp input input$ instr instrrev int integer interface is isdate isredirected kill lbound lcase left len let lib lpt line lobyte loc local locate lock lof log long longint loop loword lpos lprint lset ltrim mid minute mkd mkdir mki mkl mklongint mks mkshort mod month monthname multikey mutexcreate mutexdestroy mutexlock mutexunlock name namespace nokeyword naked next new not now object oct offsetof on once open option operator or orelse out output overload override paint palette pascal pcopy peek pipe pmap point pointcoord pointer poke pos preserve preset print private procptr property protected pset ptr public put random randomize read reallocate redim rem reset restore resume return rgb rgba right rmdir rnd rset rtrim run sadd scope scrn screen screencopy screencontrol screenevent screeninfo screenglproc screenlist screenlock screenptr screenres screenset screensync screenunlock second seek select setdate setenviron setmouse settime sgn shared shell short sin single sizeof sleep space spc sqr static stdcall step stick stop str strig string strptr sub swap system shr shl tab tan then this thiscall threadcall threadcreate threaddetach threadself threadwait time timeserial timevalue timer to trans trim true type ubound ubyte ucase uinteger ulong ulongint union unlock unsigned until ushort using va_arg va_first va_next val vallng valint valuint valulng var varptr view virtual wait wbin wchr weekday weekdayname wend while whex width window windowtitle winput with woct write wspace wstr wstring xor year zstring
preprocessor=#assert #cmdline #define defined typeof #dynamic #else #endif #error #if #ifdef #ifndef #inclib #include #lang #print #static #undef #macro #endmacro #elseif #libpath #line #pragma
The snippet goes in file geany/filedefs/filetypes.freebasic
dodicat wrote:It says a lightweight ide (at 94 Megabytes??)
The binaries are ~500 kB. The package (including i18n files, pictures, headers, ...) is less than 5 MB. I guess all further stuff in your package is related to a GTK bundle. BTW how often did you install GTK on your box? One for Gimp, one for Inkscape, one for Geany, ...?
dodicat wrote:it works fine now, I can have up to 15 command line options.
I define command line options per project, not globally. When you save a project, Geany will customize the command line options for that project.
dodicat wrote:I miss the search in the open file dialog, and the quick run.
Just type the name, search starts automatically. For quick run use the "Executer" slot (in fxm image) which is F9 by default. BTW, you can chain up several commands in the slots, like ie

Code: Select all

fbc -exx -w all "%f" & "./%e.exe"
will compile and (on success) run the current bas file (on wodniws).
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Geany to compile FB source code on Windows?

Post by BasicCoder2 »

@srvaldez
Thank you for your input. I notice that I installed Geany at the end of February this year but forgot about it. As it fired up with a Python example I thought that is all it was setup for but I suspect now that I must have also set it up for FreeBASIC.
Post Reply