954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem with using boost library

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,

kimw
Newbie Poster
22 posts since Oct 2005
Reputation Points: 44
Solved Threads: 0
 

> 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.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

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

Grunt
Junior Poster
152 posts since Jul 2006
Reputation Points: 197
Solved Threads: 12
 

thanks that was it ...

kimw
Newbie Poster
22 posts since Oct 2005
Reputation Points: 44
Solved Threads: 0
 
> 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.

VinC
Newbie Poster
16 posts since Aug 2006
Reputation Points: 28
Solved Threads: 0
 

> 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.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You