Jump to content

problem using FreeBASIC to compile .bas file to .exe


Recommended Posts

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
Link to comment
Share on other sites


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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...