Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

problem using FreeBASIC to compile .bas file to .exe

- - - - -

  • Please log in to reply
1 reply to this topic

#1
LostInSpace2012

LostInSpace2012

    Senior Member

  • Member
  • PipPipPipPip
  • 520 posts
  • OS:ME
  • Country: Country Flag

Donator

I decided to try out the FreeBASIC compiler (DOS version) which is found here:
http://freebasic.net/get

Anyway, can't seem to get my .bas files to compile into executables using this thing. I keep getting an error message that I didn't declare my variables.

For example, when it debugs my code, it says:

Error 41: Variable not declared, D in "for d = 4 to 78."


And then it has a problem with my string variables too.

Error 139: Suffixes are only valid in -lang deprecated or fblite or qb, found 'Choice' in "Choice$ = UCASE$(INKEY$)"


And the final nail in the coffin:

error 125: too many errors existing


^ Gee, thanks LOL.

The funny thing is my code runs fine in the QBasic 1.1 interpreter, and I have sucessfuly compiled this same source using QuickBasic 4.5.

I must be missing something with this FreeBasic thing. I wonder if anyone around here has used FreeBASIC to compile programs?

Edited by LostInSpace2012, 03 May 2014 - 02:34 AM.



How to remove advertisement from MSFN

#2
LostInSpace2012

LostInSpace2012

    Senior Member

  • Member
  • PipPipPipPip
  • 520 posts
  • OS:ME
  • Country: Country Flag

Donator

stupid me!

Oh, I figured it out. Apparently FreeBASIC can compile using several different dialects. Error 139 was the key. Since it doesn't autodetect which BASIC dialect you're inputing, you need to tell it by adding an argument on the command line...

So, when you input a QuickBasic source file into the FreeBASIC compiler, you must use the following command argument:

FBC -lang qb world.bas

My guitar program successfully compiled. Yay!

Here's an another example, you can save the following code as world.bas, then compile it into an .exe file.

cls
print "hello world"
end

Now, you'll have a really lame "Hello World" DOS exe file.

*Edit*
I posted the code to my DOS Clock, but the javascript messed up all the variables and strings, so I put up the easiest program known to man, the Hello World Program :-)

Maybe this will spare somebody an hour of confusion trying to figure out the FBC compiler.

Edited by LostInSpace2012, 03 May 2014 - 04:51 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN