Boost logo

Boost Users :

Subject: [Boost-users] Compile error when using program_options and lambda expression
From: Jens Auer (jensa_at_[hidden])
Date: 2012-01-23 06:16:05


Hi,

I ran into a problem when I was replacing boost::bind expressions with lambda expressions. I could boil down the problem to the following code:
#include <boost/program_options.hpp>

template<typename T> void f(T t) {}

void g()
{
   using namespace boost::program_options;

   // each of the following lines produces the error:
   // Error 1 error C2871: 'validators' : a namespace with this name does not exist
   // Error 2 error C2871: 'program_options' : a namespace with this name does not exist

   f([]() {} );
   auto x = []() {};
}

When I try to compile this on my Microsoft Visual Studio 2010 using our Boost 1.45 library, I get a compiler errors:
Error 1 error C2871: 'validators' : a namespace with this name does not exist
Error 2 error C2871: 'program_options' : a namespace with this name does not exist

To me, it looks like a compiler problem but I want to make sure that I am not running into a known issue in the boost libraries. I have search the bug database, but I have not found any issues like this one. It would be nice if someone could double-check this on another platform and boost version. If it is a compiler bug, I would then file a bug report to MS.

Best regards,
  Jens



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net