Qbasicnews.com

Full Version: "Fbc has caused an error in FBC.EXE"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I get that error whenever I try to compile my code. I would post everything, but the entire file is about 200 lines and requires some external data files (BMPs for graphics and stuff, but I suppose those are not needed to compile).

Has anyone else had this problem (and, more importantly, does anyone know how to fix it)?

--j_k
Thats complicated...but I would try checking that you dont allocate to little memory for your sprites.
So when you BLOAD it, it will read the data from the .bmp and store it outside the allocated space in your memory.
As thats what usually happens to me...when it crashes like that way you mentioned.

And a good way of debugging is isolating parts of ur code and then running it, and if it works, you know that the problem is in the part that you isolated.
What version of FreeBASIC? Can you upload just the BAS file(s) somewhere?

Anonymous

200 lines isnt that much code =P when you dont wanna post 3k+ i can understand that, but 200?

just post it =P
Just upload it to quickhost or something... It would actually be alot easier to check if all the files are there too. Wink
Quickhost = Fileanchor Dr. Smile

http://qh2.qbtk.com

Just upload it in a zip and people can download all the included files. Then paste the link here, so we can download and check it.
I'm using FB 0.13Beta, it came with vonGodric's FBIDE v0.4.

The whole thing is uploaded here [EDIT: do not use the BAS files in here; copy and paste the new ones posted below]. Unzip into your freebasic folder

So if your freebasic folder is C:\Freebasic, it should look like this:

C:\Freebasic\infantry.bas
c:\Freebasic\inf2.bas
c:\freebasic\data\bmp\terrain.bmp
c:\freebasic\data\bmp\units.bmp

infantry.bas is the original source file that won't compile.

inf2.bas is almost exactly the same as infantry.bas. I've isolated the problem to certain lines. Those lines have been commented out. As long as the comments are there, inf2.bas does compile; when I uncomment any one of the commented lines, I get the error.

Thanks for the help

--j_k

Anonymous

Code:
SUB mapLoad (file$)
        'Read MapW, MapH
        'REDIM Map(1 to MapW, 1 to MapH)
        'REDIM MapOverlay(1 to MapW, 1 to MapH)
        vid.xMin = 0
        vid.yMin = 0
        for r = 1 to MapH
            for c = 1 to MapW
       '         Read Map(r, c)
            next
        next
end sub

1st off, i duno if you can read data from a sub. so if not youre dimming arrays "FROM 1 TO 0" could be ugly. =P




Code:
SUB mapDraw ()

'       r1 = INT(vid.yMin / TileH) + 1
'       r2 = y1 + (vid.yRes / tileH)
'       c1 = INT(vid.xMin / TileW) + 1
'       c2 = x1 + (vid.xRes / TileW)
        'x = (c1 - 1) * TileW - vid.xMin
        'y = (r1 - 1) * TileH - vid.yMin
        for r = r1 to r2
            for c = c1 to c2
               ' bmpGetTile (TerrainBitmap(), 1, 1, TerrainTile(), 32, 32)
'               PUT (x,y), TerrainTile(0)
                x = x + 32
            next
            y = y + 32
        next
end sub

i did a little debugging and found somehing interesting. the first line of mapdraw becomes this

r1 = Int(0 / 32) + 1

that crashes on compilation, however

r1 = Int(0 / 32)' + 1

does not... :o :o :o :o

its frustrating. i Highly recommend posting the entire code. its like maybe 2 pages worth, some people have posted over 1k lines. i would but i dunno if i should without your permission
I posted a link to this problem at freebasic.net, so v1c can look at it. FBC should'nt crash no mater what source code you compile..

Anonymous

Quote:I posted a link to this problem at freebasic.net, so v1c can look at it. FBC should'nt crash no mater what source code you compile..

well why dont you fire him. OH WAIT thats right, noones paying for anything so stop complaining that hes taking his free time to make YOU a compiler that turns YOUR qb progs into something blazing fast that windows can run natively

meh. Point is, he's working on it. Probably more than you've ever worked on any project. I dare you to dive into fbc source code and fix the problem.
Pages: 1 2