Boost in Netbeans 7.1.1

admin

Administrator
Staff member
Trying to run the following:

Code:
        #include<iostream>
        #include<boost/filesystem/operations.hpp>

        namespace bfs=boost::filesystem;
        int main()
        {
        bfs::path p("second.cpp");
        if(bfs::exists(p))
        std::cout<<p.leaf()<<std::endl;
        }

I got some errors in cygwin so I decided to try out netbeans, and used the <a href="https://stackoverflow.com/questions/13291582/netbeans-ide-7-2-1-how-to-add-the-c-boost-library">following</a> as a guide. I added all links and the following for filesystem
Code:
Project -&gt; properties -&gt; Linker -&gt;Libraries -&gt; Add option -&gt; Other -&gt; -lfile_system
as noted <a href="http://tabreziqbal.wordpress.com/2006/03/16/how-to-test-c-boost-installation/" rel="nofollow noreferrer">here</a>. I have run a separate test using
Code:
#include&lt;boost/any.hpp&gt;
so I am not currently doubting that my boost is not installed correclty.

It seems weird to me that it is "file_system", so I also tried "filesystem" but to no avail.

When i hold
Code:
Ctrl
and click on
Code:
#include&lt;boost/filesystem/operations.hpp&gt;
my netbeans brings up my
Code:
operations.hpp
file so it seems okay (linked properly internally that it can "see" what I want it to see).

<hr>

The solution to installing boost came in the following form:
1 - If you have any path variables that are being used for Visual Studio you should temporarily change the variable during installation. <a href="http://support.microsoft.com/kb/310519" rel="nofollow noreferrer">This is a good guide</a>. Once that is done, this is one step completed.

2 - Download and install MinGW. This is a very easy process and you can find the installer files <a href="http://www.mingw.org/wiki/InstallationHOWTOforMinGW" rel="nofollow noreferrer">here</a>.

Once you have done these things (if you are in the same situation as me), you will now be able to properly install boost.

Horay!