Timer & Boost.Test incompatibility

Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace: boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation Environment: Boost 1.51.0 MSVC 2012 Windows 7 Is this a known conflict? Is there any workaround? Thanks -- Craig

Craig Henderson <cdm.henderson <at> gmail.com> writes:
Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test
When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace
boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression
boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
So this is more of a conflict between #include <boost/timer.hpp> and #include <boost/timer/timer.hpp> Is this intentional? Who support this header? Meanwhile I guess you should use library variant if Boost.Test. Gennadiy

On 19/09/12 17:35, Gennadiy Rozenal wrote:
Craig Henderson<cdm.henderson<at> gmail.com> writes:
Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test
When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace
boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression
boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
So this is more of a conflict between
#include<boost/timer.hpp> and #include<boost/timer/timer.hpp>
Is this intentional? Who support this header?
This is because Beman updated timer in the 1.48 boost release. There was no mention in the release notes as far as I recall. I have a patch for updating Boost.Test to use the new timers, since the old one is deprecated. I'll create a ticket on trac and attach the patch later today or tomorrow for your perusal. Jamie
Meanwhile I guess you should use library variant if Boost.Test.
Gennadiy
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Sep 19, 2012, at 10:23 AM, Jamie Allsop <ja11sop@yahoo.co.uk> wrote:
On 19/09/12 17:35, Gennadiy Rozenal wrote:
Craig Henderson<cdm.henderson<at> gmail.com> writes:
Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test
When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace
boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression
boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
So this is more of a conflict between
#include<boost/timer.hpp> and #include<boost/timer/timer.hpp>
Is this intentional? Who support this header?
This is because Beman updated timer in the 1.48 boost release. There was no mention in the release notes as far as I recall. I have a patch for updating Boost.Test to use the new timers, since the old one is deprecated. I'll create a ticket on trac and attach the patch later today or tomorrow for your perusal.
On a related note, progress.hpp is still includes boost/timer.hpp, so it is not currently (at least as of 1.50) possible to use the new timers and the progress display in the same compilation unit. --Daniel

On 19/09/12 18:50, Daniel Russel wrote:
On Sep 19, 2012, at 10:23 AM, Jamie Allsop<ja11sop@yahoo.co.uk> wrote:
On 19/09/12 17:35, Gennadiy Rozenal wrote:
Craig Henderson<cdm.henderson<at> gmail.com> writes:
Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test
When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace
boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression
boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
So this is more of a conflict between
#include<boost/timer.hpp> and #include<boost/timer/timer.hpp>
Is this intentional? Who support this header?
This is because Beman updated timer in the 1.48 boost release. There was no mention in the release notes as far as I recall. I have a patch for updating Boost.Test to use the new timers, since the old one is deprecated. I'll create a ticket on trac and attach the patch later today or tomorrow for your perusal.
On a related note, progress.hpp is still includes boost/timer.hpp, so it is not currently (at least as of 1.50) possible to use the new timers and the progress display in the same compilation unit.
Indeed, and my patch addresses this in the Boost.Test context but not in the wider context. I'll post back when I get this attached to a ticket tomorrow.
--Daniel
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 20/09/12 00:40, Jamie Allsop wrote:
On 19/09/12 18:50, Daniel Russel wrote:
On Sep 19, 2012, at 10:23 AM, Jamie Allsop<ja11sop@yahoo.co.uk> wrote:
On 19/09/12 17:35, Gennadiy Rozenal wrote:
Craig Henderson<cdm.henderson<at> gmail.com> writes:
Hi, I am starting a new project. I am using boost::timer::cpu_timer from boost/timer/timer.hpp and Boost.Test
When I include boost/test/included/unit_test.hpp in my unit test suite, I get compilation errors where boost::timer is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace
boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression
boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
So this is more of a conflict between
#include<boost/timer.hpp> and #include<boost/timer/timer.hpp>
Is this intentional? Who support this header?
This is because Beman updated timer in the 1.48 boost release. There was no mention in the release notes as far as I recall. I have a patch for updating Boost.Test to use the new timers, since the old one is deprecated. I'll create a ticket on trac and attach the patch later today or tomorrow for your perusal.
On a related note, progress.hpp is still includes boost/timer.hpp, so it is not currently (at least as of 1.50) possible to use the new timers and the progress display in the same compilation unit.
Indeed, and my patch addresses this in the Boost.Test context but not in the wider context. I'll post back when I get this attached to a ticket tomorrow.
I've attached a patch to https://svn.boost.org/trac/boost/ticket/7397 based on what we use in production. We're still on 1.49, but this patch is against trunk. Jamie
--Daniel
_______________________________________________ Unsubscribe& other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (4)
-
Craig Henderson
-
Daniel Russel
-
Gennadiy Rozenal
-
Jamie Allsop