Multithreading – upgrading threads using CLR

Using Visual Studio 2008 and boost library 1.46 1 I want to compile and link the following and / or CLR flags:

#include <boost/thread/thread.hpp>
void run() {}
int main(int argc,char *argv[])
{
    boost::thread t(run);   
}

The first error is about the dummy - struct of the forward declaration in boost:: thread This post solves this problem by declaring:

namespace boost {
    struct thread::dummy {};
}

Of course, I can compile now, but I'll get a linker warning

Warning 1 warning lnk4248: 'boost detail. win32._ Security_ Unresolved typeref token of attributes' (0100001f); The image may not work

Run application results

The application cannot start correctly (0xc000007b)

The suggestions in the forum thread mentioned earlier do not apply to me I have built a static version of boost threads lib, which runs normally without / CLR flag There is no difference between debugging / publishing I run on win7 32 bit

Any tips?

Solution

I have encountered this problem. I don't remember where I got this, but a solution is to declare "boost. Detail. Win32. _security_attributes", including all boost headers like this

namespace boost { 
    namespace detail { 
        namespace win32 { 
            struct _Security_ATTRIBUTES: public ::_Security_ATTRIBUTES {}; 
        };
    };
};

If you want everyone to see it, remove the namespace

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>