Does anyone know how to pre-pend and append a double quote in a #include using the preprocessor?
I would like to create a preprocessor macro say FULL_PATH that I will use to #include files as followed
#include FULL_PATH(PATH, FILE_NAME)
I do want to use VC++ Include Environment Variables less since they are annoying to utilize with dozens of projects written by me and other people, especially when some projects occasionally have files with the same name.
I've tried an example below
#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
#define BOOST_DO_JOIN2( X, Y ) X##Y
#define boost_dir( __X ) BOOST_JOIN("C:/Boost/boost_1_44_0/", #__X)
#pragma message( boost_dir(boost/thread/mutex.hpp) )
#include boost_dir(boost/thread/mutex.hpp)
The #pragma message expands to the correct file name
C:/Boost/boost_1_44_0/boost/thread/mutex.hpp
The #include does not work however; possibly missing double quotes.
fatal error C1083: Cannot open include file: 'C:/Boost/boost_1_44_0/': Permission denied
If I add a double quote as a prefix and suffix, it's is if the code was
#include "\"C:/Boost/boost_1_44_0/boost/thread/mutex.hpp\""
when I would want it to be
#include "C:/Boost/boost_1_44_0/boost/thread/mutex.hpp"