Page 1 of 1
nested includes from subdirectory ... ?
Posted: Wed Apr 05, 2006 12:40 pm
by helpy
Following directory structure:
Code: Select all
- source (directory)
- main.pb (XIncludeFile "include\inc.pbi")
+ include (directory)
- inc.pbi (XIncludeFile "sub_inc.pbi")
- sub_inc.pbi
Compiler error ... "sub_inc.pbi" could not be found!
It would be nice if nested includes would be found by the compiler!
cu, helpy
Posted: Wed Apr 05, 2006 7:08 pm
by helpy
Maybe this is more a feature request, than a bug. than it should be moved to the appropriate forum.
thanks, helpy
Posted: Fri Apr 07, 2006 8:54 am
by horst
see my posting:
http://www.purebasic.fr/english/viewtop ... ncludepath
In an included file it is impossible to refer to its own directory.
Posted: Fri Apr 07, 2006 9:18 am
by helpy
That is BAD! For me it is a bug ...
I vote for changing this behaviour!
The bad thing is, that Import/ImportC also refer to the Include Path!
Scenario:
- I have a Library and its *.pbi file (or several *.pbi files) in a seperate directory (.\main_source_directory\mylibrary_version_1_0)
- In the pbi file there I use ImportC "mylibrary.lib"
- At the moment I use the following in the main source file (in .\main_source_directory):
Code: Select all
IncludePath "mylibrary_version_1_0"
XIncludeFile "mylibrary.pbi"
IncludePath ""
- If I use:
Code: Select all
XIncludeFile "mylibrary_version_1_0\mylibrary.pbi"
... the Library will not be found by the compiler
I really do not like this behaviour
cu, helpy
Posted: Thu Aug 17, 2006 7:38 am
by mskuma
I've run into a similar issue.. trying to compartmentalise my includes into subfolders, and some of those PB includes include some other stuff in their own folder.. so in this case, it's a bit of a nightmare to get PB to compile from the top pb file without 'include not found' problems, and also still maintain 'portability' of these includes (for other projects).
I am not really sure of a solution, but I was thinking when compiling reaches these includes, if there is a import library reference (e.g. Import "mylib") it would be good if PB could first check the folder where the pb is (i.e. the folder of the pb file that has the reference to the lib), and try to resolve the lib there before going off anywhere else. The same thing could be done perhaps for any includes that particular pb file has also.
Alternatively, perhaps making includepath support more than one path, instead of just one for all files.
Posted: Thu Aug 17, 2006 9:08 am
by horst
mskuma wrote:.. so in this case, it's a bit of a nightmare to get PB to compile from the top pb file without 'include not found' problems, and also still maintain 'portability' of these includes (for other projects).
I think, the solution is extremely simple:
(1) The default IncludePath is the path of the current file.
(2) An IncludePath statement is valid for the current file only.
Maybe a "Use path of main file" statement for sort of "Callback Includes" could be optional, but this should not be the only possible behaviour.
Posted: Thu Aug 17, 2006 9:37 am
by mskuma
horst wrote:I think, the solution is extremely simple:
(1) The default IncludePath is the path of the current file.
(2) An IncludePath statement is valid for the current file only.
I think that makes sense. In any case, it certainly would be good to see any improvement to avoid these tangly situations.. I hope this is taken up as a valid issue. Thanks.
Posted: Sun Sep 30, 2007 5:34 am
by mskuma
I tried helpy's example with the 4.10 beta3 hoping it was resolved, but seems not. Seems like this more recent post is reporting a similar issue
http://www.purebasic.fr/english/viewtopic.php?t=27722
Is there any chance this problem will be resolved in the near future? Thanks.