Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to #include files with relative path to the current one?
#1
#include <file> includes from the library; in order to include from the directory of the including file, the main program, i tried #include <./file> but it doesn't work. Even #include <~/path_to_the_project/file> doesn't work.

The only solution I've found is: #include </home/user/path_to_the_project/file>, that is, including the whole path from the file system root.

Is there any way to configure the including directories? It would be great to include files with relative path from the current directory if they exist, and from the library if they don't exist.
Reply
#2
The standard way (e.g. C compilers) is use angles < ... > for compiler-library files. Use double quotes " ... " for your files. So try:
Code:
#include "filename.bas"
and this will include the file relative to your source path.
Reply
#3
boriel Wrote:The standard way (e.g. C compilers) is use angles < ... > for compiler-library files. Use double quotes " ... " for your files.

How much distracted I was! Thank you. There is a mention about it in the Library page. An #INCLUDE page is coming Smile
Reply
#4
programandala.net Wrote:
boriel Wrote:The standard way (e.g. C compilers) is use angles < ... > for compiler-library files. Use double quotes " ... " for your files.

How much distracted I was! Thank you. There is a mention about it in the Library page. An #INCLUDE page is coming Smile

I'm glad the library page is being appreciated :-)

Perhaps a page on # commands generally, linking to specifics? #include #Pragma, #line, #define #Ifdef.... etc.
Reply
#5
britlion Wrote:
programandala.net Wrote:
boriel Wrote:The standard way (e.g. C compilers) is use angles < ... > for compiler-library files. Use double quotes " ... " for your files.

How much distracted I was! Thank you. There is a mention about it in the Library page. An #INCLUDE page is coming Smile

I'm glad the library page is being appreciated :-)

Perhaps a page on # commands generally, linking to specifics? #include #Pragma, #line, #define #Ifdef.... etc.
Yes, this goes into the *preprocessor* directives help. The zxbpp preprocessor is called automagically on each file before starting compilation/assembling.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)