Pages

3. Finish Setting up Environment

Prep Work

Go to the c:\apps\basic directory and create another directory called Projects.  You will use this later to hold the programs you write.  Create one more directory called Doc, again in the c:\apps\basic directory, to hold help files and documentation you will find helpful.

If we go back to the sourceforge site we can download the windows help file for FreeBASIC. The following link will start the download:
https://sourceforge.net/projects/fbc/files/Documentation/FB-manual-1.05.0-chm.zip/download

Extract the .chm file into your Doc directory.  If you double click the file you may get a Windows security warning.  Accept the warning and open the file.  When I open it, I get the index in the left panel but no contents on the right.
FreeBASIC Manual .chm file

This is a Windows security measure.  To see the contents you need to:
  1. close the file;
  2. right click on the file and select properties (bottom option);
  3. select Unblock and OK.
Unblock .chm file to view contents
Opening the file will now show you the contents.

While we are on the topic of help and documentation, FreeBASIC has an active forum that you can learn an enormous amount about FreeBASIC, and programming in general, from a group of dedicated people who voluntarily respond to queries promptly.  The link to the forum is:   http://www.freebasic.net/forum/  .  The site has  good search facilities and is divided into areas of interest from beginners to experts.

Code Editor

In the last post we used the default text editor, notepad, to write a simple Hello World program.  We explained that you cannot use a word processor as that will add additional formatting code in the text that the FreeBASIC compiler does not understand and will cause errors.

The text editor worked for our simple one-line program however, once we start working on larger programs, we need a tool that will make coding easier.  An integrated development environment (IDE) is such a tool and, apart from a code editor, includes help for completing code, highlighting of various parts of the code, easy compile and run functions, amongst many other features.

The editor we have chosen to use is FBEdit, currently at version 1.0.7.6c.  Sourceforge has an older version so for the latest version you will need to go to:

https://www.freebasic-portal.de/downloads/ides-fuer-freebasic/fbedit-ide-30.html

Please note the page is in German however Chrome does a pretty good of translating the page. The download is the Zip archive (2.94MB) on the right hand side of the web site.

Once downloaded, extract the file into the c:\apps\basic directory in a directory of its own.  Leave it with the same name as the archive, FbEdit1076c.  If it is ever upgraded then the new IDE with its version number will get a new directory as well.

FbEdit in its own directory
After extracting the the FbEdit1076c file the resulting directory contains a number of files and sub-directories.

FbEdit Options

The executable we are interested in is called FbEdit.exe.  Double clicking this file will open a dialog box for configuring various options:

FbEdit Path Options Dialog
At the 'Default Project Path:' prompt you can either enter ..\projects (they are two dots before \projects  - two dots means the directory directly before or above this one) or find the same directory using the '...' option button.  For 'Compiler Path:' enter ..\fb , and for 'Help Path' enter ..\Doc.  The benefit of using the .. notation rather than explicitly spelling out the exact path means that you can put the entire Basic directory onto a memory stick and FbEdit will be able to find all the bits it needs.

FbEdit Path Options filled
Accepting the directories you have nominated presents you with an option to Activate FbEdit Lite  for beginners.  It is recommend that you do NOT taking this option. The standard version has a few more options that you will use.  The menus not in the Lite version are: Format; Debug; Resource; and Tools. There are also additional options within each common menu that you will not find in the Lite version.  From a cursory scan we could not see an option to convert the Lite version to the standard version.  You could simply reinstall FbEdit and change the option when it comes up.  Of course you would lose any settings you had changed.

The next options you should adjust sits in the Options menu, is called Help Menu, and manages access to various help resources.  The first item is the Win32 help file.  A copy of the required file in chm format can be found at the following location: http://laurencejackson.com/win32/ Download the file and place a copy in the Doc directory, then change the Help Menu Option to point the the right location as shown below:

Win32 help file option

The FreeBASIC item in the above menu must be set to point to the chm file we copied across at the start of this post.  Leave the remaining two menu items as presented.

Now if we choose the Help menu in FbEdit all the help options will work for you.  If you find that you only see the left panel of the chm files, remember to the 'unblock' process shown above.  

If you have some spare time on your hands you can go through the help files.  You will find a wealth of information; of particular interest are the FreeBASIC help option and the FbEdit help option.

This post was longer that anticipated but hopefully it has resulted in an environment you can use to start programming in FreeBASIC.

Please feel free to leave a comment and see you in the next post.

No comments:

Post a Comment