views:

29

answers:

1

Hi,

I'm learning the boost preprocessor library (because i need to use it), and I wanted to try the file iteration mechanism. I've set up a minimal project with a.cpp and b.hpp. What I'm trying to do is including many time b.hpp via the boost pp :

#include <boost/preprocessor/iteration/iterate.hpp>

#define BOOST_PP_ITERATION_LIMITS (0, 5)
#define BOOST_PP_FILENAME_1 "b.hpp"
#include BOOST_PP_ITERATE()

When I try to compile (with -E to see the preprocessor result) :

g++ -E a.cpp > pp_result

I got this error :

In file included from a.cpp: /usr/local/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:47:37: error: b.hpp: No such file or directory

b.hpp is in the same directory, I can't see what I'm dooing wrong. It seems the g++ searches b.hpp in the same directory as forward1.hpp, but following the boost documentation my code should work (my boost version is 1.44).

Does anybody experienced the same problem ?

A: 

Yep, you need to add -I. to the command line in order to make it work. This adds the directory you started gcc in to the include search path, allowing the compiler to find the file b.hpp.

hkaiser