Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem building boost\optional\optional.hpp in VS2010
From: Pally Sandher (pally.sandher_at_[hidden])
Date: 2011-08-15 13:06:34


In ASIMNET.CPP

#include "stdafx.h"
#include <boost/math/special_functions/round.hpp>

[snipped]

bool CAsimNetwork::AppendNetwork(CAsimNetwork& import, bool verticalPlacement, bool duplicateHeating, bool duplicateCooling) {

        CRect networkRect = GetNetworkRect();
        CRect importRect = import.GetNetworkRect();

        CFmPoint sourcePt(importRect.left, importRect.top);
        double translation[2] = {0.0, 0.0};

        if (networkRect.Width() == 0 || networkRect.Height() == 0) {
                //empty network to start with, just move to the origin
                translation[X] = -sourcePt[X];
                translation[Y] = -sourcePt[Y];
        } else {
                if (verticalPlacement) {
                        CFmPoint targetPt(networkRect.left, networkRect.bottom);

                        // descend a further 3 cells vertically
                        targetPt[Y] -= TILEWIDTH * 3;
                        translation[X] = targetPt[X] - sourcePt[X];
                        translation[Y] = targetPt[Y] - sourcePt[Y];
                } else {
                        CFmPoint targetPt(networkRect.right, networkRect.top);

                        // descend a further 3 cells horizontally
                        targetPt[X] += TILEWIDTH * 3;
                        translation[X] = targetPt[X] - sourcePt[X];
                        translation[Y] = targetPt[Y] - sourcePt[Y];
                }
        }

        //round to the nearest multiple of the tile width
        translation[X] = boost::math::round( (translation[X]/TILEWIDTH) ) * TILEWIDTH;
        translation[Y] = boost::math::round( (translation[Y]/TILEWIDTH) ) * TILEWIDTH;
[snipped]

In stdafx.h
[snipped]
#include "vemacro.h"
[snipped]
#include "asimdefs.h"
[snipped]

In VEMACRO.H
[snipped]
enum Coord {X = 0, Y = 1, Z = 2};
[snipped]

In Asimdefs.h
[snipped]
#define TILEWIDTH 48
[snipped]

I've tried switching off pre-compiled headers for this project as the documentation recommends to no avail. If I comment out the 2 lines which use boost::math::round & the header include it compiles fine.

Thanks in advance.

Palbinder Sandher
Software Deployment Engineer
T: +44 (0) 141 945 8500
F: +44 (0) 141 945 8501

http://www.iesve.com
**Design, Simulate + Innovate with the <Virtual Environment>**
Integrated Environmental Solutions Limited. Registered in Scotland No. SC151456
Registered Office - Helix Building, West Of Scotland Science Park, Glasgow G20 0SP
Email Disclaimer

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Nathan Ridge
Sent: 05 August 2011 21:05
To: Boost Mailing List
Subject: Re: [Boost-users] Problem building boost\optional\optional.hpp in VS2010

> Hi,
>
> We've been using boost v1.36 in Visual Studio 2005 for a few years now. I'm attempting to upgrade our projects & solutions to build in Visual Studio 2010 & thus I've upgraded to boost 1.47.0. However I'm getting an error when trying to compile a project which uses some boost functions
>
> Full text of the error message is as follows:
>
> 1> ASIMNET.CPP
> 1>c:\code\inc\boost\optional\optional.hpp(346): error C2061: syntax error : identifier 'm_storage'
> 1> c:\code\inc\boost\optional\optional.hpp(345) : while compiling class template member function 'void boost::optional_detail::optional_base<T>::construct(const std::locale &)'
> 1> with
> 1> [
> 1> T=boost::io::detail::locale_t
> 1> ]
> 1> c:\code\inc\boost\optional\optional.hpp(500) : see reference to class template instantiation 'boost::optional_detail::optional_base<T>' being compiled
> 1> with
> 1> [
> 1> T=boost::io::detail::locale_t
> 1> ]
> 1> c:\code\inc\boost\format\internals.hpp(56) : see reference to class template instantiation 'boost::optional<T>' being compiled
> 1> with
> 1> [
> 1> T=boost::io::detail::locale_t
> 1> ]
> 1> c:\code\inc\boost\format\internals.hpp(57) : see reference to class template instantiation 'boost::io::detail::stream_format_state<Ch,Tr>' being compiled
> 1>
> 1>Build FAILED.
> 1>
>
> The only references to boost in ASIMNET.CPP are as follows:
>
> #include <boost/math/special_functions/round.hpp>
>
> translation[X] = boost::math::round( (translation[X]/TILEWIDTH) ) * TILEWIDTH;
> translation[Y] = boost::math::round( (translation[Y]/TILEWIDTH) ) * TILEWIDTH;
>
> Any help will be most appreciated.

The following compiles fine for me with MSVC10 and boost 1.47.0:

#include <boost/math/special_functions/round.hpp>
 
const int TILEWIDTH = 5;
const int X = 0;
const int Y = 1;
 
double translation[2] = {1.0, 1.0};
 
int main()
{
    translation[X] = boost::math::round( (translation[X]/TILEWIDTH) ) * TILEWIDTH;
    translation[Y] = boost::math::round( (translation[Y]/TILEWIDTH) ) * TILEWIDTH;
}

Could you provide a complete example that fails to compile for you?

Thanks,
Nate
                                               
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


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