
On 1/23/2011 1:27 PM, Hossein Haeri wrote:
Dear all,
I am trying to use BOOST_PP_FILENAME_1 for a header file in my current directory. Unless I hardcode the full address, GCC 4.5.1 (MinGW32, WinXP, SP3) says it can't find the same file in which I am using BOOST_PP_FILENAME_1! Is there any way I can go for relative file names? I have already checked the following -- neither works for the same reasons:
#define BOOST_PP_FILENAME_1 "./Header.hpp" //1
#define BOOST_PP_FILENAME_1 ".\Header.hpp" //2
#define BOOST_PP_FILENAME_1 "Header.hpp" //3
It is because BOOST_PP_FILENAME_1 expands in a Boost PP header file. In GCC a relative file name is relative only to the file in which it is included. Since it is a Boost PP header file that does the including, your relative header file will not be found. In VC++ on Windows relative header files are relative to an entire chain of header files being included to that point from the source file on down, so a relative header file as you have above would be found. I ran into this same problem also and ended up just using a non-relative name of the form <boost\myLibrary\myHeader.hpp> for all compilers as the easiest solution.