Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > compiler gives me error message " boost/smart_ptr.h: No such file ordirectory"

Reply
Thread Tools

compiler gives me error message " boost/smart_ptr.h: No such file ordirectory"

 
 
Pallav singh
Guest
Posts: n/a
 
      04-27-2009
Hi All ,

while compiling the following code my compiler gives me error message
" boost/smart_ptr.h: No such file or directory" . do i need to give
some comiplation option for it ...such as where to find header file

> g++ -g file.cc


#include<iostream>
#include "boost/smart_ptr.h"
using namespace std;

class A
{
int a,b;
public :
void printf()const
{ cout<<" value of a "<<a <<"Value of b "<<b <<endl ;}
};

int main()
{
boost::shared_ptr< A > sample(new A);
printf("The Sample now has %i references\n", sample.use_count());

boost::shared_ptr< A > sample2 = sample;
printf("The Sample now has %i references\n", sample.use_count());

sample.reset();
printf("The Sample now has %i references\n", sample2.use_count());

return 0;
}

Thanks
Pallav Singh
 
Reply With Quote
 
 
 
 
Gert-Jan de Vos
Guest
Posts: n/a
 
      04-27-2009
On Apr 27, 8:26*pm, Pallav singh <(E-Mail Removed)> wrote:
> Hi All ,
>
> while compiling the following code my compiler gives me error message
> " *boost/smart_ptr.h: No such file or directory" . do i need to give
> some comiplation option for it ...such as where to find header file


Try: #include <boost/smart_ptr.hpp>

You may need to add the -I option with the path where your boost
library is installed, if not already present in the INCLUDE
environment
variable.
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      04-28-2009
On Apr 27, 8:35 pm, Gert-Jan de Vos <gert-
(E-Mail Removed)> wrote:
> On Apr 27, 8:26 pm, Pallav singh <(E-Mail Removed)> wrote:


> > while compiling the following code my compiler gives me error message
> > " boost/smart_ptr.h: No such file or directory" . do i need to give
> > some comiplation option for it ...such as where to find header file


> Try: #include <boost/smart_ptr.hpp>


That shouldn't change anything. The standard says that when
using #include "...", if the search fails, the directive is
reprocessed as if it were #include <...>.

> You may need to add the -I option with the path where your
> boost library is installed, if not already present in the
> INCLUDE environment variable.


He definitely needs to tell the compiler where to look for the
headers, if they aren't installed in the "standard places".
What the standard places are, of course, depends on the
compiler; for g++, it's derived from where the compiler itself
is installed, with the adjunction (at least under Unix) of
"/usr/include", and maybe "/usr/local/include".

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
Gert-Jan de Vos
Guest
Posts: n/a
 
      04-28-2009
On Apr 28, 9:41*am, James Kanze <(E-Mail Removed)> wrote:
> On Apr 27, 8:35 pm, Gert-Jan de Vos <gert-
>
> (E-Mail Removed)> wrote:
> > On Apr 27, 8:26 pm, Pallav singh <(E-Mail Removed)> wrote:
> > > while compiling the following code my compiler gives me error message
> > > " *boost/smart_ptr.h: No such file or directory" . do i need to give
> > > some comiplation option for it ...such as where to find header file

> > Try: #include <boost/smart_ptr.hpp>

>
> That shouldn't change anything. *The standard says that when
> using #include "...", if the search fails, the directive is
> reprocessed as if it were #include <...>.


..hpp rather than .h might make the difference..
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      04-29-2009
On Apr 28, 11:03 am, Gert-Jan de Vos <gert-
(E-Mail Removed)> wrote:
> On Apr 28, 9:41 am, James Kanze <(E-Mail Removed)> wrote:


> > On Apr 27, 8:35 pm, Gert-Jan de Vos <gert-


> > (E-Mail Removed)> wrote:
> > > On Apr 27, 8:26 pm, Pallav singh <(E-Mail Removed)> wrote:
> > > > while compiling the following code my compiler gives me error message
> > > > " boost/smart_ptr.h: No such file or directory" . do i need to give
> > > > some comiplation option for it ...such as where to find header file
> > > Try: #include <boost/smart_ptr.hpp>


> > That shouldn't change anything. The standard says that when
> > using #include "...", if the search fails, the directive is
> > reprocessed as if it were #include <...>.


> .hpp rather than .h might make the difference..


Using the correct name of the file is a requirement, yes.
I'd missed that you'd changed the name of the file, as well as
changing the form from "..." to <...>. (And generally, if Boost
is correctly installed, you probably should consider it part of
the "implementation", so <...> would be more appropriate.)

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"require 'sqlite3'" gives "no such file to load -- sqlite3 (LoadError)" Jeffrey 'jf' Lim Ruby 5 04-09-2007 10:58 AM
Compiler gives error of missing ']' while it's already there. vasudevmukherjee@yahoo.co.uk C Programming 3 10-25-2005 05:01 PM
Compiler Error Message: The compiler failed with error code -1073741819 Ram ASP .Net 0 09-13-2005 09:52 AM
Compiler Error Message: The compiler failed with error code 128. Yan ASP .Net 0 07-21-2003 10:49 PM



Advertisments