致命错误C1001:使用/ clr托管代码进行编译时,编译器中发生内部错误 [英] fatal error C1001: An internal error has occurred in the compiler, when compiling with /clr managed code

查看:209
本文介绍了致命错误C1001:使用/ clr托管代码进行编译时,编译器中发生内部错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参与boost 1.64的进程间模块。

Involved boost 1.64's interprocess module.

VS版本:VS 2015 Update 3.

VS version: VS 2015 Update 3.

VC编译器_MSC_FULL_VER:190024210

VC compiler _MSC_FULL_VER: 190024210

粘贴简化代码。使用/ clr创建一个项目并在cpp文件中添加以下内容。

Pasted the simplified code. Create one project with /clr and add the following in a cpp file.

项目的常规设置:

#pragma managed(push, off)

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/mem_algo/simple_seq_fit.hpp>
#ifdef WIN32
#include <boost/interprocess/managed_windows_shared_memory.hpp>
#endif

# include <boost/interprocess/containers/vector.hpp>
# include <boost/interprocess/containers/string.hpp>
# include <boost/interprocess/allocators/allocator.hpp>



namespace ZZZZ {
	namespace service {

		namespace ssv_elem_type
		{
			typedef boost::uint32_t id_type;
		}

		//// ZZZZServiceClientServerShared/cross_process_types.h

		typedef boost::int32_t cp_int;
		typedef boost::uint32_t cp_uint;


		//// ZZZZServiceClientServerShared/managed_shared_memory.h
		
		typedef boost::interprocess::offset_ptr<void, boost::int32_t, boost::uint64_t, 8> offset_ptr_t;
		//typedef boost::interprocess::offset_ptr<void,cp_int,cp_uint,8> offset_ptr_t;

#if defined(WIN32) || defined(_WIN64)
		typedef boost::interprocess::basic_managed_windows_shared_memory <
#else
		typedef boost::interprocess::basic_managed_shared_memory<
#endif
			char
			//,	boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family , offset_ptr_t>
			, boost::interprocess::simple_seq_fit<boost::interprocess::mutex_family, offset_ptr_t>
			, boost::interprocess::iset_index
		> managed_shared_memory_t;

		using boost::interprocess::create_only_t;
		using boost::interprocess::open_only_t;
		
		//// ZZZZServiceClientServerShared/basic_exception.h
		
		class basic_exception : public std::runtime_error
		{
		public:
			explicit basic_exception(char const* what)
				: std::runtime_error(what)
			{
			}
		};

		//Interprocess typedefs part 1.

		typedef managed_shared_memory_t memory_manager_t;

		typedef boost::interprocess::allocator<
			char
			, managed_shared_memory_t::segment_manager
		>  char_allocator_t;

		typedef boost::interprocess::basic_string<char, std::char_traits<char>, char_allocator_t> string_t;

		string_t testC1001Func()
		{
			memory_manager_t seg;
			string_t ss(char_allocator_t(seg.get_segment_manager()));
			return ss;
		}

	}
}

#pragma managed(pop)

推荐答案

您好
MSDNer_Eric,

感谢您在此处发帖。

此论坛是关于Microsoft产品的c ++开发问题。对于与升级库更相关的案例,我建议您连接到
提升社区为了更好的支持。

This forum is about c++ development issues with Microsoft products. For your case which is more related to boost library, I suggest you connect to boost community for better support.

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最诚挚的问候,

Sera Yu

Best Regards,
Sera Yu


这篇关于致命错误C1001:使用/ clr托管代码进行编译时,编译器中发生内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆