i am trying to use a boost library

#include "boost/date_time/gregorian/gregorian.hpp"

and my source file is in the same folder as boost. however, during compilation i get errors that directories that gregorian.hpp links to (boost/date_time/compiler_config.hpp) could not be found.

i've checked that all the files that gregorian.hpp links to are in the correct paths.

any feedback is appreciated.

regards,

> and my source file is in the same folder as boost.
This is a mistake - don't put your code in the same place as third-party libraries.

In essence, you should have
gcc -I/path/to/boost prog.c

Where /path/to/boost is the top-level directory of where your boost header files are installed (say /usr/include/boost)

If you're using some IDE, then how you configure compiler search paths depends on that IDE.

There is some kind off settings problem with your files. I can't think of any other reason. Check again.

> and my source file is in the same folder as boost.
This is a mistake - don't put your code in the same place as third-party libraries.

Is this bad practice or simply illegal? How/why should it affect anything?

I don't mean to challenge you or anything. I'm learning and my text doesn't seem to address the issue.

> Is this bad practice or simply illegal? How/why should it affect anything?
It's just bad practice.
If the library gets updated, and it just happens to use the same filename as one you've chosen, it's bye bye code for you.

Also, anyone else trying to use the same library code (or even you on another project) risk picking up unintended files.

Plus when source is distributed, it always exists in separate directory structures.

This article has been dead for over six months. Start a new discussion instead.