FlexBasic #Include
Mickster
Posts: 2,698
Creates a link (which is super-cool) but doesn't recognise it as a file-name.
Is it me?
Craig
Comments
Can you share your actual code? I'm guessing there's some hidden character or something that's messing things up. #include works fine for me, even with file names with spaces; for example, I can compile and run the attached testinc.bas just fine as long as Test Constants.bas is in the same directory.
Special characters....of course (I think.... not at my desk)
So the automagic hyperlink is not FlexProp's doing (?)
I'm editing/saving in Notepad++ and the file automatically updates in FlexProp. I guess the hyperlink is what Notepad++ is doing. Probably a setting that I can change somewhere.
I have to say that it's kinda cool though. Click on the link and FlexProp loads the include to a new tab.
Craig
The automagic hyperlink is FlexProp (the GUI). But that doesn't do anything to change the source code, it just has a pattern matcher in the editor that sees #include and highlights what is after it. The GUI seems to recognize the #include OK, but the compiler doesn't, which is odd (and makes me think there's something funny in the file).
@ersmith
Hi Eric,
I think it has something to do with my file-name Phnx_const.bas. Seems like the "const" confuses the compiler. Only just arrived at my desk but this appears to be the problem.
Many thanks once again
Suggestion: If you ever have a burning desire to do anything with the GUI, it would be nice if Run Binary would just run the latest compilation...maybe have a separate button for Select/Run Binary?
Regards,
Craig
Edit: Nope....I can even have it mess-up with a completely fresh start in the GUI. Still experimenting.
@ersmith
Appears to be a problem with the include file when created in Notepad++
Modifying your include file and saving in Notepad++ ....no problem
Creating an almost identical copy and saving in Notepad++....problem.
Craig
@Mickster : Ah, I think I see it now -- your copy does not end with a carriage return / line feed. I think the preprocessor is just literally pasting the file in, so when the last line of the included file has no line terminator the line gets continued into the next file, causing lots of grief. For now the work-around is to always end included files with a line terminator. I'll see if I can change the preprocessor to add one automatically.
Doh! Dead simple
Thanks again
Craig
It's the endless End-Of-Line (to distinguish from End-Of-Life) battle, between Unix-alike (Linux; MacOS) and Dos/Windows, still spreading its deleterious effects...
https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings
Henrique
In my case, the include file contained pasted text. If I'd typed it, there would've been a CR+LF on the end.
I was thrown-off by thinking the compiler was complaining about the Include line but it was the actual file causing mischief
Craig