Problems running the official FB examples?

General FreeBASIC programming questions.
Post Reply
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Problems running the official FB examples?

Post by h4tt3n »

Hello folks,

I've been looking at some of the sample code snippets that come bundled with Freebasic (using 1.05 64 bit on windows 10). When trying to compile and run an example in FBEdit, a code sippet with name xyz.bas returns the error "xyz.bas() error 26: File access error, xyz.c". So far, all examples have failed in the same way. Notice how .bas is changed to .c. Copy-pasting the code into a new file does not remove the error, it just passes a "xyz.bas() error 23: File not found, xyz.bas". I have to copy-paste and save the file into another directory to make anything work. What's going on? Is this a FBEdit specific error?

Cheers,
Mike
St_W
Posts: 1627
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Problems running the official FB examples?

Post by St_W »

Do you have write-access to the example folder(s)? If you have installed FreeBasic in "C:\Program Files" I'd suggest to copy the examples you're interested in to some documents folder (like "My Documents") or any other folder with according permission settings.
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: Problems running the official FB examples?

Post by h4tt3n »

That might very well be it. However, any attempt at removing the read-only flag from any folder or file made no difference. Moving the examples, inc, and lib folders somewhere else has solved the problem for all snippets that doesn't depend on external libraries and created whole new waves of problems for the ones that do. Specifically, I am trying to get the SDL (Simple DirectMedia Layer) examples working, but it seems that the necessary .dll's aren't there. As a fun extra challenge, the freebasic forum software won't let you use the search term "sdl" because it is too common :-)
St_W
Posts: 1627
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Problems running the official FB examples?

Post by St_W »

The read-only flag is unimportant. The access permissions are the ones that matter. And those are quite restricted in "C:\Program Files" and other system folders. Copy/Move only the examples folder (or specific subfolders of it, which you're interested in), not the inc or lib folders! Otherwise the compiler can't find them anymore. You don't need write access in those folders during compilation.

It is true that third party components (like the SDL library) are not shipped with FreeBasic. Download those from the according external site. For SDL this is https://www.libsdl.org/
Shipping all external dependencies probably wouldn't be possible due to licensing issues and at least blow up the FreeBasic package by serveral hundrets of MB.

Yes, the forum search and especially the wiki search are bad ...
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Problems running the official FB examples?

Post by MrSwiss »

The simplest way to get around this problem (on Windows) is:
  • don't use the installer package of FBC! --> IMPORTANT
  • with either .zip / .7z simply choose a directory (or make a new one), below c:\
  • unpack/unzip into that directory ... finished
With a install like that, there are no more problems, with examples (only, if there are no external lib's required).
Post Reply