error: namespace ‘foo::bar’ not allowed in using-declaration
This is a wiki page. Be bold and improve it!
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations using boost::filesystem; int main() { return 0; }
compiling:
g++ boost_example.cpp -o run
boost_example.cpp:2: error: namespace ‘boost::filesystem’ not allowed in using-declaration
The error comes from the fact that filesystem is a namespace and not a class.
Header synopsis namespace boost { namespace filesystem { } }
So:
using boost::filesystem;
should be:
using namespace boost::filesystem;