PE6 #include

Hendriks

Member
This used to work:
Code:
#include "Initialization.basinc"
Now I get a compile error:
Code:
Syntax error on line 72 at position 1 
Error: Can not open the input file
If I put the full path in the filename it compiles ok, but this is a bit inconvenient for me.

Anyone knows why it doesn't work without full path description?
 

srnet

Senior Member
Somone is bound to ask which version you were using when it worked and which version you are using now.
 

Hendriks

Member
I updated every version as soon as it came out, uptil 6.0.7.4.
I am 'almost' certain that it used to work with this version...
 

Goeytex

Senior Member
Are the main program file and the ".basinc" file located in the same folder/directory? If not, then the complete path for the include file is necessary.

The compiler throwing a Syntax error is misleading as the the syntax is fine. The compiler simply cannot locate the include file.
 

Hendriks

Member
I have a workspace with 4 Basic Files (for slot0-slot3) and 1 Include File containing initialization which is Included in each Basic File. All files are in one and the same directory.

I start editing by clicking the workspace (.WSP) file so that the basic files and the accompanying PDF's are all loaded in one go.
 

oracacle

Senior Member
the only time I have used include I used the entry

Code:
[color=Navy]#include [/color][color=Red]"Z:\Macro Rail 2\Macro rail 1\macro Rail\Proto 6\Programmes\Proto 2\Symbols.bas"[/color]
 

Technical

Technical Support
Staff member
The picaxe preprocessor hasn't changed for several releases.

If not an absolute filename, the ppp first looks in the calling folder of the main file.
What is this folder name - is it very long or use unusual characters?
 

Hendriks

Member
It is long but not exceptional:
C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Thermostaat.wsp
All other files are in this same directory.
 

Technical

Technical Support
Staff member
Do you have the same problem on a real path (ie not a virtual path like google drive)?
 

Hendriks

Member
Ok I copied the complete folder to my desktop.
After clicking "Thermostaat.wsp" it looks like its working ok but actually the basic files that get loaded are the ones that still are on the google drive.
So I removed all "C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\" references from "Thermostaat.wsp":
Code:
  <CodeDocuments>
    <string>C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Slot 0 Main.bas</string>
    <string>C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Slot 1 Settings1.bas</string>
    <string>C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Slot 2 Settings2.bas</string>
    <string>C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Slot 3 QAA35.3.bas</string>
    <string>C:\Users\User\Google Drive\Drive\Projects\CV\Eigen thermostaat\Picaxe Thermostaat\28X2\Initialization.basinc</string>
  </CodeDocuments>

changed to:

  <CodeDocuments>
    <string>Slot 0 Main.bas</string>
    <string>Slot 1 Settings1.bas</string>
    <string>Slot 2 Settings2.bas</string>
    <string>Slot 3 QAA35.3.bas</string>
    <string>Initialization.basinc</string>
  </CodeDocuments>
Now the correct basic files and include file are loaded.
But the compiler still cannot find the Include File unless I write the full path in the #include filename.
 

Technical

Technical Support
Staff member
Its not the path of the workspace .wsp file (or filenames within the workspace) that is important for #include, it is the real path of the main .bas file (the one that is active when you hit program/check syntax) that is used as the relative path ie the ppp uses the path of the initial .bas file.
 

Hendriks

Member
The main.bas file has the same path as the include.basinc file.
So why can't I refrain from writing the full path in the Basic files?
 

Technical

Technical Support
Staff member
The main.bas file has the same path as the include.basinc file.
So why can't I refrain from writing the full path in the Basic files?
You shouldn't need to. It works ok for us here with a relative path rather than an absolute path.
Plesae email both the main.bas file and the include .basinc files to support at picaxe.com and we'll take a look.
 
Top