How do I run Freebasic?

New to FreeBASIC? Post your questions here.
Post Reply
Oldned
Posts: 3
Joined: Dec 22, 2009 6:04

How do I run Freebasic?

Post by Oldned »

I have downloaded freebasic for windows. When I click on the icon I get
what looks like DOS. What do I do next? Where do I enter source code?
I am a very raw beginner and know nothing about DOS.
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Post by St_W »

You have to run the FreeBasicCompiler just to build an executable file from your source code.

You type your source code in a normal text-file with the specific file-extension ".bas". You could use every text-editor to write the code, but I suggest using an IDE like FBedit or FBide.

If you use a normal text-editor you have to open command-prompt (cmd.exe on Win NT (2k, XP, Vista, 7, ...); command.com on Win9x (95, 98, Me)) and run the FreeBasic Compiler with the source-code file as Parameter.
If you've installed FreeBasic with the Installer you've a shortcut to command-prompt on your Desktop and in your Start-menu.

Run the command-prompt, change to the FreeBasic Compiler Directory (if you don't use the Shortcut created by FreeBasic Installer) and type

Code: Select all

fbc "myProg.bas"
if your source-code is located in the file "myProg.bas".

Type "fbc" (without quotes) to get a list and a short description of the different options that are possible (for example to create a GUI application, use QuickBasic compatibility mode, ...).

____________________________

As mentioned above I'd suggest using an IDE (Integrated Development Environment) that runs the Compiler for you so that you don't have to open command-prompt (console window).

FBedit is a great IDE. Get it at http://radasm.cherrytree.at/fbedit/

Using FBedit you've to enter your Path to the FreeBasicCompiler (fbc.exe) just once and you can easily compile your files with a simple click on the compile-button.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

I'll Sticky this up in Beginners. This can be the definitive answer thread for this question.
MMAN
Posts: 1
Joined: Feb 20, 2010 10:52
Location: Dallas,TX

using FREEBASIC

Post by MMAN »

I am teaching the fundamentals of programming to a group of 6th graders in TX. I have Just Basic, a new QBASIC (that only runs in a small window) and now I have downloaded FREEBASIC. I am more than a little confused on how one gets this to work.
1. I installed the program
2.When I select the desktop short cut with my xp platform, I end up with a small window what displays the free basic path
3. there are no directions on how to run a program, input a program, the samples are displayed as BMP's and nothing seems to wrok
4. I tried the most basic of all programs:

print "hello"

Then I tried selecting enter, pressing F5 etc and could not get the program to work. Could someone tell me or refer me to a site or location where I can get this to work?

Thanks
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

Hello MMAN!

FreeBASIC is a BASIC compiler. That means you feed it a BASIC source code file and it outputs an EXE file. There are no facilities for editing your file. You must do that in a text editor or use one of the many code editors that are available. My personal favorite is FBEdit which you can find here...

http://www.freebasic.net/forum/viewtopi ... ght=fbedit

Once installed FBEdit allows you to edit your source code and organize files into projects. Then when you press compile, FBEdit calls the FreeBASIC compiler and passes the names of the source code files for compilation, returning any errors found.

It may take a little work getting FBEdit configured and making sure all the PATH variables are pointing to all the correct places, but it is well worth it.

I personally put together an installer for Windows that comes with FBEdit and FreeBASIC pre-configured. The version of FBEdit is not current but still works well. You can get that here...

FreeBASIC & FBEdit Installer

Hope that helps...

-Vince
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

how do i

Post by TESLACOIL »

Switches

to hide the dos box (console) that sits in the background

run this program start_shell.exe. This opens a black dos box

then type

fbc -s gui myprog.bas

(this is the switch yo use if you have the windows version of fbide.exe)
(check your paths are correct)


the screen command means your program opens in a new separate window defined by you.


My example hello world program


'$lang:"qb"
screen 19
cls
print "hello world"
sleep

:note the '$lang:"qb" line one of my program code
this sets the compiler to quick basic compatibility mode which is useful if you come from that version

fbide.exe can compile some other variations of basic too
rolliebollocks
Posts: 2655
Joined: Aug 28, 2008 10:54
Location: new york

Post by rolliebollocks »

Q: "All I get is a flashing black box..."

A:

1. Download this: http://prdownloads.sourceforge.net/fbid ... e?download
2. Install it
3. Run it
4. Load your hello.bas prog into it
5. Hit F-5 to compile

hello.bas

Code: Select all

print "Hello World"
sleep
...

(People seem to find this helpful+FB-Ide is more QBasic like than FBEdit)

*Edit: Set so that people do not download the old bundle with FB .15
exagonx
Posts: 314
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: How do I run Freebasic?

Post by exagonx »

Oldned wrote: Dec 22, 2009 6:22 I have downloaded freebasic for windows. When I click on the icon I get
what looks like DOS. What do I do next? Where do I enter source code?
I am a very raw beginner and know nothing about DOS.
Hello Oldnet.

FreeBASIC being a compiler and not an IDE you need to use a software to write your code in FreeBASIC.
So first of all you have to get a suitable software for writing the source code:
Geany
FBEdit
GEdit
Notepad

Once you have written your code you have to save it in a file with .BAS extension
Example:
myprog.bas

Importantly, if you don't use the FreeBASIC shell I suggest you create a script in BAT CMD or SH with the compile command

Windows and DOS:

Code: Select all

fbc myprog.bas
If the command doesnt work you have to put in system path the folder where are installated the FreeBASIC
defalut vaule for Windows:
c:\Programs\FreeBASIC\bin

default command for autoexec.bat for DOS:
PATH = %PATH%;C:\FreeBASIC\bin
Andrew92
Posts: 8
Joined: Apr 28, 2022 23:19

Re: How do I run Freebasic?

Post by Andrew92 »

Hey team! I'm an all-around massive newb in programming right now, I stumbled across the forum and thought ''why not?'' so here I am.

This thread was really helpful in getting me started! I'll be sure to ask around for more help to better understand just what I'm doing here :lol:
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: How do I run Freebasic?

Post by paul doe »

Andrew92 wrote: May 27, 2022 16:46 ...
This thread was really helpful in getting me started! I'll be sure to ask around for more help to better understand just what I'm doing here :lol:
Welcome. Make sure you have the latest official release (1.09.0). Also, try to look out if there's already an answer to any inquiry you might have. Have fun :)
Andrew92
Posts: 8
Joined: Apr 28, 2022 23:19

Re: How do I run Freebasic?

Post by Andrew92 »

paul doe wrote: May 27, 2022 17:04
Andrew92 wrote: May 27, 2022 16:46 ...
This thread was really helpful in getting me started! I'll be sure to ask around for more help to better understand just what I'm doing here :lol:
Welcome. Make sure you have the latest official release (1.09.0). Also, try to look out if there's already an answer to any inquiry you might have. Have fun :)
would this be where I can find the latest version? https://freebasic.en.softonic.com/
paul doe
Moderator
Posts: 1730
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: How do I run Freebasic?

Post by paul doe »

Andrew92 wrote: May 27, 2022 17:11 would this be where I can find the latest version? https://freebasic.en.softonic.com/
You always have them here, in this very forum (under 'The DOWNLOADS you are MOST LIKELY looking for...'):

viewforum.php?f=1
Andrew92
Posts: 8
Joined: Apr 28, 2022 23:19

Re: How do I run Freebasic?

Post by Andrew92 »

paul doe wrote: May 27, 2022 17:15
Andrew92 wrote: May 27, 2022 17:11 would this be where I can find the latest version? https://freebasic.en.softonic.com/
You always have them here, in this very forum (under 'The DOWNLOADS you are MOST LIKELY looking for...'):

viewforum.php?f=1
Thank you so much! I'll get on this
Laurens
Posts: 17
Joined: Mar 16, 2022 9:16
Location: Flevoland, the Netherlands

Re: How do I run Freebasic?

Post by Laurens »

If you also plan to use other platforms like Linux, I recommend Geany as IDE, because of the availability of binaries in Windows, MacOS and Linux. And if you're getting more experienced, the source is available too, in order to compile it into other platforms. Then all is looking about the same in the different systems.
Andrew92 wrote: May 27, 2022 17:11 would this be where I can find the latest version? https://freebasic.en.softonic.com/
It's important to know websites like Softonic modify the software, in most cases adding ads and other software you likely wouldn't like.
Post Reply