Sample programs

New to FreeBASIC? Post your questions here.
JLWest
Posts: 12
Joined: Jan 12, 2018 8:43

Sample programs

Postby JLWest » Jan 15, 2018 4:16

Trying to run the examples that come with FreeBASIC-1.05.0-win64.

Most of them don't seem to work or am I doing something wrong. Seems a lot of #Include .bi files are not found.
Tourist Trap
Posts: 2383
Joined: Jun 02, 2015 16:24

Re: Sample programs

Postby Tourist Trap » Jan 15, 2018 16:13

JLWest wrote:Trying to run the examples that come with FreeBASIC-1.05.0-win64.

Most of them don't seem to work or am I doing something wrong. Seems a lot of #Include .bi files are not found.

Edit ;)
More than a discourse, what example do you try to launch so I could try here (or anyone)? I also just installed fb64 for windows.
St_W
Posts: 1375
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Sample programs

Postby St_W » Jan 15, 2018 16:42

JLWest wrote:Most of them don't seem to work or am I doing something wrong.
Probably the latter ;-)
Could you tell us an example for an error message you got?
Also note that many examples demonstrate the use of third-party components with FreeBasic. Of course those samples won't work without installing the respective third party components appropriately.
If that is the problem maybe this FAQ entry could help you: https://freebasic.net/wiki/wikka.php?wa ... FAQ#item25
jj2007
Posts: 842
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Sample programs

Postby jj2007 » Jan 15, 2018 16:58

St_W wrote:Of course those samples won't work without installing the respective third party components appropriately

If that is the case, then surely there is a line on top of the example saying "before compiling this, install xyz from http://www...
MrSwiss
Posts: 2762
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Sample programs

Postby MrSwiss » Jan 15, 2018 17:14

jj2007 wrote:... then surely there is a line on top of the example saying ...
Yes, of course, as soon as you (personally), have converted, all of those files! <laugh, loud>
jj2007
Posts: 842
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Sample programs

Postby jj2007 » Jan 15, 2018 18:18

MrSwiss wrote:
jj2007 wrote:... then surely there is a line on top of the example saying ...
Yes, of course, as soon as you (personally), have converted, all of those files! <laugh, loud>

For examples that I have written myself, I do that, see e.g.Printing a sinus via the FPU, the CRT, the GSL, and Python. Authors who are writing for a language called "Beginner's All-purpose Symbolic Instruction Code" should do that IMHO.
MrSwiss
Posts: 2762
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Sample programs

Postby MrSwiss » Jan 15, 2018 18:59

I've read that particular comment from you before (at least once).

Let me quickly explain, how it "comes across":
  • I want to have changed (whatever, according to my idea)
  • however, I don't want to do it myself ...
That just won't happen, because "implementors" have, plenty of "own ideas", which
will always have "precedence", over ideas from others.

Btw: We are talking about very old code, as in FB's samples which, may not even run,
with current FB compiler's.
St_W
Posts: 1375
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Sample programs

Postby St_W » Jan 15, 2018 20:57

Let's see what problem the OP is actually facing. IMHO the examples make clear when non-standard components are used (and if not, at least the linker error does so, and is explained in the FB FAQ).

And yes, practically all samples are very old and some may still have 64-bit compatibility issues.
BasicCoder2
Posts: 3295
Joined: Jan 01, 2009 7:03

Re: Sample programs

Postby BasicCoder2 » Jan 15, 2018 21:10

JLWest wrote:Trying to run the examples that come with FreeBASIC-1.05.0-win64.
Most of them don't seem to work or am I doing something wrong. Seems a lot of #Include .bi files are not found.

Just because the example code "comes with" the latest version of FreeBASIC does not mean they were written to run with the latest version of FreeBASIC. You may have to use the version of FreeBASIC that existed when the code was written. Also I think win64 can even make that buggy. I have old FreeBASIC code I cannot run anymore and it would be easier to rewrite them rather than try and modify them for the latest FreeBASIC compiler. That is just part of how it is in the modern programming world for all languages. For example I am using SDL2 and simply ignore code examples written for SDL. If the code will not compile just forget about it until you are advanced enough to modify it should it still be of interest.

The include files may also not be compatible with the current latest of FreeBASIC?
If you can't find a .bi file try searching for it with google.
Last edited by BasicCoder2 on Jan 15, 2018 21:15, edited 2 times in total.
St_W
Posts: 1375
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Sample programs

Postby St_W » Jan 15, 2018 21:14

BasicCoder2 wrote:Just because the example code "comes with" the latest version of FreeBASIC does not mean they were written to run with the latest version of FreeBASIC.
I don't agree on that; the samples that are shipping with FreeBasic are intended to work with that version and are adapted to work with the latest versions, in case something breaks. If something doesn't work please submit a bug report.
BasicCoder2
Posts: 3295
Joined: Jan 01, 2009 7:03

Re: Sample programs

Postby BasicCoder2 » Jan 15, 2018 21:17

St_W wrote:
BasicCoder2 wrote:Just because the example code "comes with" the latest version of FreeBASIC does not mean they were written to run with the latest version of FreeBASIC.
I don't agree on that; the samples that are shipping with FreeBasic are intended to work with that version and are adapted to work with the latest versions, in case something breaks. If something doesn't work please submit a bug report.

Well I stand corrected. I didn't know that someone was making sure that was the case.
St_W
Posts: 1375
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Sample programs

Postby St_W » Jan 15, 2018 21:54

BasicCoder2 wrote:Well I stand corrected. I didn't know that someone was making sure that was the case.
I don't want to claim that someone actively checks all the samples for each release (although I've written a tool some time ago to do that: https://bitbucket.org/st_w/fb-jenkins/s ... ?at=master ), but they are definitly intended to work with the FreeBasic version they are shipping and bugs are fixed if they are detected. It just may happen that bugs remain undetected, so I just would like to encourage anyone to report a problem when it is found. And don't be afraid in case it later turns out that the problem is caused by some other error (e.g. a user error) - nobody will be blamed ;-) (that doesn't mean that you shouldn't check for potential other errors first yourself as far as you are able to, though)
JLWest
Posts: 12
Joined: Jan 12, 2018 8:43

Re: Sample programs

Postby JLWest » Jan 16, 2018 0:12

Thanks for the reply's. I'll give it another try.

Trying to learn all this is like drinking from a fir hose.

I would like to bugle a simple windows application, really find it difficult to get started.
JLWest
Posts: 12
Joined: Jan 12, 2018 8:43

Re: Sample programs

Postby JLWest » Jan 16, 2018 0:52

You have to remember I'm a novice to this with limited programming experience.

1. Tried biz2compress.ba in FreeBASIC-1.05.0-win64\examples\compression\biz2compress.bas

"F:\FreeBASIC-1.05.0-win64\fbc.exe" "F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas"
Compiler output:
F:\FreeBASIC-1.05.0-win64\bin\win64\ld.exe: cannot find -lbz2
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win64 (64bit)
OS: Windows NT 6.2 (build 9200)

2. libzip.bas in FreeBASIC-1.05.0-win64\examples\compression\libzip.bas
This one has more hangups than a walk in closet.

3. quicklz.bi in FreeBASIC-1.05.0-win64\examples\compression\ quicklz.bi
"F:\FreeBASIC-1.05.0-win64\fbc.exe" "F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas"

Compiler output:
F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas(4) error 23: File not found, "quicklz.bi" in '#include "quicklz.bi"'

Results:
Command executed:
"F:\FreeBASIC-1.05.0-win64\fbc.exe" "F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas"

Compiler output:
F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas(4) error 23: File not found, "quicklz.bi" in '#include "quicklz.bi"'

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win64 (64bit)
OS: Windows NT 6.2 (build 9200)

Compiler output:
F:\FreeBASIC-1.05.0-win64\examples\compression\FBIDETEMP.bas(4) error 23: File not found, "quicklz.bi" in '#include "quicklz.bi"'

4. zlib in FreeBASIC Compiler - Version 1.05.0 (01-31-2016), built for win64 (64bit)
lots of errors.

I got to be doing something wrong. None of the programs in FreeBASIC-1.05.0-win64\fbc.exe" "F:\FreeBASIC-1.05.0-win64\examples\ will compile.

Is there an order they have to be compiled?
dodicat
Posts: 5152
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Sample programs

Postby dodicat » Jan 16, 2018 1:37

These compression files need the associated library files (dll or .a) which should be downloaded separately.

quicklz.bi seems to be in the 32 bit inc folder.

64 bit FreeBASIC is relatively new.

Try examples\GUI\win32\calendar.bas.
This uses the windows built in libraries.
You'll soon get the hang of it.
Some of the examples\graphics should run straight off.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 1 guest