Freebasic 1.03 problems

General FreeBASIC programming questions.
Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Freebasic 1.03 problems

Post by Cpcdos »

Hi,

I've downloaded the newest freebasic version, and when I compile my programs I have this :
C:\FreeBASIC\inc\zlib.bi(65) error 14: Expected identifier in 'const SEEK_SET = 0'
C:\FreeBASIC\inc\zlib.bi(66) error 14: Expected identifier in 'const SEEK_CUR = 1'
C:\FreeBASIC\inc\zlib.bi(67) error 14: Expected identifier in 'const SEEK_END = 2'
If I delete this 3 lines, this work...

Someone have a solution?

Best regards
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Freebasic 1.03 problems

Post by counting_pine »

Strange. Is this a DOS-specific problem?
I'm not sure why that error would come up, and only for those const lines. I can only find a similar error message on putting just the word 'Const' on its own.
Perhaps they are #defined somewhere in your code or other headers?
What happens if you put the line const SEEK_SET = 0 at other points in your program, before or any header inclusions?
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Freebasic 1.03 problems

Post by dkl »

It's probably the CRT headers that have #defines for these constants, and zlib.bi now started using Const since FB 1.02.0. So they're currently incompatible, but it's easy to fix.
fatman2021
Posts: 215
Joined: Dec 14, 2013 0:43

Re: Freebasic 1.03 problems

Post by fatman2021 »

LLVM code generating crashes with a segmentation fault. Generated C/ASM code could be more readable.
Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Re: Freebasic 1.03 problems

Post by Cpcdos »

Hi,
thank you all for your answers
I've tested to include this 3 lines in my fb code, or change location, same problem :(
This little problem can be resolved for next version?
Thank you
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Freebasic 1.03 problems

Post by dkl »

Cpcdos
Posts: 207
Joined: Mar 06, 2013 13:52
Location: France - LYON 69003
Contact:

Re: Freebasic 1.03 problems

Post by Cpcdos »

"SourceForge developer pages are presently offline." :(
fxm
Moderator
Posts: 12161
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.03 problems

Post by fxm »

Cpcdos wrote:"SourceForge developer pages are presently offline." :(
since Friday!
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Freebasic 1.03 problems

Post by MrSwiss »

Hello all,

there seems to be a problem with BLoad used as a Function:

Code: Select all

Dim As Long ret=0
Dim As Any Ptr scrimg = ImageCreate(300, 50, , 32)
ret = Bload ExePath & "\xxxx.bmp", scrimg    ' <-- compiler error "error 1: Argument count mismatch, found 'ExePath' in 'ret = Bload ExePath & "\DigiIF.bmp", scrimg'"
This seems to indicate, that the compiler doesn't recognize the "concatenated string" as such.
The same happens when using + (to simply add the two Strings).

The alternative (working) way:

Code: Select all

Dim As Any Ptr scrimg = ImageCreate(300, 50, , 32)
Bload ExePath & "\xxxx.bmp", scrimg
Doing a later error check by referencing err:

Code: Select all

If err Then
     ...
EndIf
It seems that internal checking has been 'overdone', at least in this particular case.
fxm
Moderator
Posts: 12161
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.03 problems

Post by fxm »

Code: Select all

Dim As Long ret=0
Dim As Any Ptr scrimg = ImageCreate(300, 50, , 32)
ret = Bload(ExePath & "\xxxx.bmp", scrimg)
See my advise at:
http://www.freebasic.net/forum/viewtopi ... 68#p208368
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Freebasic 1.03 problems

Post by MrSwiss »

@fxm,

it is IMO just another "workaround", not a cure at the root ...
fxm
Moderator
Posts: 12161
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.03 problems

Post by fxm »

No, this is not a workaround.
This is the normal syntax when calling a function.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Freebasic 1.03 problems

Post by MrSwiss »

OK, granted ... however, it still doesn't explain why the version without the function return works as written.

IMO: either both generate the error or none, but not mixed results!
fxm
Moderator
Posts: 12161
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.03 problems

Post by fxm »

I dare not mention documentation at KeyPgFunction (paragraph Description / Returning values) because this is me who has written!
fxm
Moderator
Posts: 12161
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Freebasic 1.03 problems

Post by fxm »

MrSwiss wrote:.... however, it still doesn't explain why the version without the function return works as written.
Because in that case, the function is called as a SUB!
Post Reply