Lorena Sfăt
Lorena Sfăt

Reputation: 235

namespace boost has no member

I downloaded the latest version of Boost libraries 1_60_0 and I tried to use it but I quickly ran into troubles.

boost::unordered_map<int, int> map;

This piece of code says "namespace boost has no member unordered_map". I checkd the file, it is there though. The same happened for basically everything I tried to acces from the boost namespace.

Header includes are as follows:

#include <D:/IP/boost_1_60_0/boost/graph/adjacency_list.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/graph_traits.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/connected_components.hpp>
#include <D:/IP/boost_1_60_0/boost/unordered_map.hpp>
#include <D:/IP/boost_1_60_0/boost/graph/floyd_warshall_shortest.hpp>
#include <D:/IP/boost_1_60_0/boost/numeric/ublas/matrix.hpp>
#include <D:/IP/boost_1_60_0/boost/numeric/ublas/io.hpp>

I'm guessing I should include something more, but no clue what. Any tips?

Upvotes: 1

Views: 4074

Answers (1)

Hatted Rooster
Hatted Rooster

Reputation: 36473

unordered_map.hpp includes other boost header files this way:

#include <boost/config.hpp>

Which means that the boost folder has to be set as an additional include directory for this to work.

I'm assuming you're compiling on MSVC, if so, right click your project : properties -> C/C++ -> General and add the folder D:/IP/boost_1_60_0/ as Additional Include Directory.

The docs also answers this question for you.

Upvotes: 3

Related Questions