How do I run Freebasic?

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

How do I run Freebasic?

Postby Oldned » 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.
St_W
Posts: 1376
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Postby St_W » Dec 22, 2009 7:36

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: 5953
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Dec 22, 2009 20:25

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

Postby MMAN » Feb 20, 2010 11:05

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: 2981
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Postby vdecampo » Feb 20, 2010 14:13

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

Postby TESLACOIL » Jun 24, 2010 2:49

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

Postby rolliebollocks » Apr 07, 2011 23:16

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

A:

1. Download this: http://prdownloads.sourceforge.net/fbide/FBIde_0.4.6.exe?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

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 2 guests