Raj
Raj

Reputation: 33

basic_timed_mutex.hpp(159): fatal error C1001: An internal error has occurred in the compiler

I have problem when I am building project in Visual Studio 2010 for 64bit. I couldn't able to build for 64bit with boost library, I am getting below error. I can build for 32bit but not for 64bit.

    \boost_1_49_0\boost\thread\win32\basic_timed_mutex.hpp(159): fatal error C1001: An internal error has occurred in the compiler
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\wvm\mdmiscw.c', line 2704)
5  To work around this problem, try simplifying or changing the program near the locations listed above.
5>  Please choose the Technical Support command on the Visual C++ 
5>   Help menu, or open the Technical Support help file for more information
5>  The command exited with code 2.

It is pointing error to the below code and ofcourse I can't change the boost library. I am confused with this error

void unlock()
            {
                long const offset=lock_flag_value;
                long const old_count=BOOST_INTERLOCKED_EXCHANGE_ADD(&active_count,lock_flag_value);
                if(!(old_count&event_set_flag_value) && (old_count>offset))
                {
                    if(!win32::interlocked_bit_test_and_set(&active_count,event_set_flag_bit))
                    {
                        win32::SetEvent(get_event());
                    }
                }
            }

Can you please help me,

Thank you

Edited :

I am not sure where the error but I think its in the boost libraries, there is a cpp file like

Class a::a(, point, )
{
}

and the "point" is a namespace which is defined in a header file which is using boost libraries and it has following code

#include <boost/thread.hpp>
#include <boost/thread/recursive_mutex.hpp>

    namespace point 
    {
// some work1
    void fun()
    {
    boost::unique_lock< boost::recursive_mutex > lck(*m_RedrawMutex);
// some work2
    }
// some work3
    }

Answer :
It finally worked !! After two days of search, I found another way.I just changed the order of include path in the project header where it was using boost basic_timed_mutex.hpp. I placed boost include path at the top and it worked. It's strange!!!

Upvotes: 0

Views: 1414

Answers (1)

John Bargman
John Bargman

Reputation: 1262

I've had this same issue myself - and it seems to be related to certain code-blocks in boost itself. It appears to be caused by a bug in the MSVC compiler toolchain.

Disabling optimisation appears to solve the issue for many users As per this MSDN article - Source from MSDN suggesting this fix Souce on stack-overflow

I wish I could present a logical cause, or bug report on the issue, but for myself the problem was solved by upgrading to Boost 1.60.

That said, other uses have reported that trailing-slashes are the cause!

update:

After some browsing it appears this issue can be caused by everything from infinite-loops, though to templates types holding function pointers. and doesn't always list the actual-source of the error correctly (eg: it's not where the error message says it is). That said, disabling optimisation appears to solve the issue near universally - at the cost that your software may run slower.

Upvotes: 1

Related Questions