Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
its fussy about #include
#1
the compiler doesnt like it when #include statements are not the first thing in a line
so this will work:
#include
but this will not:
<space> #include
the error message complains about a period or full stop being in the wrong place which is not the right issue.

This may turn someone off the language if they cant solve the problem
Reply
#2
This is not exactly a bug. Every preprocessor line *must* start with # as a first character. Otherwise is a BASIC line (which will trigger a syntax error).
To tabulate preprocessor lines, use tab *after* the # symbol:

Code:
REM this is Wrong
    # include <file.bas>

REM this is OK
#    include <file.bas>
Reply
#3
btw, about #include, can i only use include on libraries placed at '(installed-directory)/library/' ? would be great if the compiler would check them also on other directories, like from a './library/' where the compilable .bas code is, for a more comfortable use when we create our own libraries, and don't want to mess them with the default ones? or maybe i'm missing some important documented information? what do you all think?
Reply
#4
IF you use #include "file.bas" instead of <file.bas> it will look in the same directory as the current basic file, rather than in the library.
Reply
#5
britlion Wrote:IF you use #include "file.bas" instead of <file.bas> it will look in the same directory as the current basic file, rather than in the library.

I was having trouble with that myself thanks
Reply
#6
Notice that all this behavior (the # placement and the "filename.bas" and <filename.bas> includes) is the cpp (C PreProcessor) standard behavior. :wink:
Reply
#7
I split up my code into 2 files so now I have to include linefile.bas
I tried this:

#include "linefile.bas"


but it says

Error: cannot open "linefile.bas" file.

im sure it is in the same directory as main.bas
Reply
#8
Capital letters?
Reply
#9
all lowercase

strangely it works in tommy gun but not in BorIDE
Reply
#10
Can you run it from the command line?
Code:
zxb -Tab main.bas
If it does not complain, it's probably not related to the compiler. Also check lettercase in the name (some OS requires the letter case to match the file name).
Reply
#11
Strange... I tested it in BorIDE and it was working fine, even without the path but in same directory as the main file, it found and included the file without problems.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#12
when I ran the command line it said cant open file like with BorIDE,

so..why does it work with tommy gun?
Reply
#13
slenkar Wrote:when I ran the command line it said cant open file like with BorIDE,

so..why does it work with tommy gun?
When you send me all files, I can try. At moment I'm not at home. Will return sunday, but can download small files and check them.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#14
i sent you both files now
Reply
#15
slenkar Wrote:i sent you both files now
No new messages yet in contro panel... Sure you sent them to me?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)