Boost logo

Boost Users :

Subject: Re: [Boost-users] C1001 ice with date/time and Boost 1.38
From: himanshu.agarwal_at_[hidden]
Date: 2009-08-20 01:28:04


> Dear all,
>
> I just downloaded Boost 1.38 and got ice with VStudio 2003 and sp1:
>
> c:\Work Sdk\boost_1_38_0\boost\date_time\gregorian\conversion.hpp(43) : fatal
> error C1001: INTERNAL COMPILER ERROR
> (compiler file 'msc1.cpp', line 2708)
> Please choose the Technical Support command on the Visual C++
> Help menu, or open the Technical Support help file for more
> information
>
> It took me 3 hours to solve but it seems that if the /FR (Include All Browse
> Information) is on, this error is generated.

Hi

I also encountered the same problem, tried this solution.
This worked for one of my project, but not for other one.

On looking at development code of boost, It appears that they might have solved this in new version
Tried that code and it worked

Here is the solution:
Create a file with name "boost_conversion.h" and contents given below and include it before any boost include in you code

boost_conversion.h
____________________________________________________________________________________________________
/*
////////////////////////////////////////////////////////////////////////////////////////////

This file is a hack to boost_1_37\boost\date_time\gregorian\conversion.hpp file
When boost_1_37\boost\date_time\gregorian\conversion.hpp is compiled under Visual Studio 2003.NET
foillowing error appear:
fatal error C1001: INTERNAL COMPILER ERROR
        (compiler file 'msc1.cpp', line 2708)
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information
The same issue is also reported on boost-user group, please refer followin hyperlink:
http://archive.netbsd.se/?ml=boost-users&a=2009-02&t=9851835
This issue might solve in boost 1.40 version.
This code is modified from boost taking code from development version of boost
////////////////////////////////////////////////////////////////////////////////////////////
*/

//Enable this file only for VS 2003.NET Compiler
#if _MSC_VER >= 1310 and _MSC_VER < 1400

#ifndef _CUSTOM_GREGORIAN__CONVERSION_HPP___
#define _CUSTOM_GREGORIAN__CONVERSION_HPP___

/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
 * Use, modification and distribution is subject to the
 * Boost Software License, Version 1.0. (See accompanying
 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 * Author: Jeff Garland, Bart Garst
 * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
 */

#include <exception>
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/c_time.hpp"
#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
# if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS)
# include "boost/date_time/gregorian/formatters_limited.hpp"
# else
# include "boost/date_time/gregorian/formatters.hpp"
# endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
#else
# include <sstream>
# include "boost/date_time/gregorian/gregorian_io.hpp"
#endif // USE_DATE_TIME_PRE_1_33_FACET_IO

namespace boost {

namespace gregorian {

  //! Converts a date to a tm struct. Throws out_of_range exception if date is a special value
  inline
  std::tm to_tm(const date& d)
  {
        if (d.is_special())
    {
        std::string s = "tm unable to handle ";
        switch (d.as_special())
        {
        case date_time::not_a_date_time:
            s += "not-a-date-time value"; break;
        case date_time::neg_infin:
            s += "-infinity date value"; break;
        case date_time::pos_infin:
            s += "+infinity date value"; break;
        default:
            s += "a special date value"; break;
        }
        boost::throw_exception(std::out_of_range(s));
    }
    std::tm datetm;
    boost::gregorian::date::ymd_type ymd = d.year_month_day();
    datetm.tm_year = ymd.year-1900;
    datetm.tm_mon = ymd.month-1;
    datetm.tm_mday = ymd.day;
    datetm.tm_wday = d.day_of_week();
    datetm.tm_yday = d.day_of_year()-1;
    datetm.tm_hour = datetm.tm_min = datetm.tm_sec = 0;
    datetm.tm_isdst = -1; // negative because not enough info to set tm_isdst
    return datetm;
  }

  //! Converts a tm structure into a date dropping the any time values.
  inline
  date date_from_tm(const std::tm& datetm)
  {
    return date(static_cast<unsigned short>(datetm.tm_year+1900),
                static_cast<unsigned short>(datetm.tm_mon+1),
                static_cast<unsigned short>(datetm.tm_mday));
  }
  

} } //namespace boost::gregorian

//this will disable original boost gregorian conversion hpp file
#define _GREGORIAN__CONVERSION_HPP___

#endif //_CUSTOM_GREGORIAN__CONVERSION_HPP___

#endif//_MSC_VER >= 1310 and _MSC_VER < 1400
____________________________________________________________________________________________________

Regards

Himanshu Agarwal

agarwal.himanshu502_at_[hidden]

***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority.
 
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.

Visit our website at www.rbs.com

***********************************************************************************


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