Newbie question - include local files

Linux specific questions.
Post Reply
timrichards99
Posts: 2
Joined: Jul 27, 2021 17:45

Newbie question - include local files

Post by timrichards99 »

Hi, totally new to FB and I'm learning the syntax.

I cant figure this out - how to include local files, I'm on linux.

/home/xxx/FB/project1/this.bas <----- this has the main file to run
/home/xxx/FB/includes/inc01.bas <------ this is my include file

I tried this but it didnt work:

chdir("../") ' to parent dir
#include curdir+"/includes/inc01.bas"

Help appreciated :)
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Newbie question - include local files

Post by caseih »

Try #include "../includes/foo.bi"

or pass the include path to the compiler with the -I argument.

#include is a known as a pre-processor directive. It's handled before any code is compiled so the effect of chdir() does not happen. Also you can't call any procedures like curdir.
timrichards99
Posts: 2
Joined: Jul 27, 2021 17:45

Re: Newbie question - include local files

Post by timrichards99 »

Thank you :)
Post Reply