大佬教程收集整理的这篇文章主要介绍了c – Boost编译器错误?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#include "stdafx.h" #include <boost/interprocess/shared_memory_object.hpp> #include <boost/interprocess/file_mapping.hpp> #include <boost/interprocess/mapped_region.hpp> using namespace std; int main() { using boost::interprocess; // Create the file mapping file_mapping fm("input.dat",read_only); // Map the file in memory mapped_region region(fm,read_only); // Get the address where the file has been mapped float * addr = (float *)region.get_address(); std::size_t elements = region.get_size() / sizeof(float); }
但我有两个问题,因为我得到的主要问题:
1>tasker.cpp(98): error C2873: 'boost::interprocess' : symbol cAnnot be used in a using-declaration 1>tasker.cpp(101): error C2065: 'file_mapping' : undeclared identifier 1>tasker.cpp(101): error C2146: @L_607_1@ error : missing ';' before identifier 'fm' 1>tasker.cpp(101): error C2065: 'read_only' : undeclared identifier 1>tasker.cpp(101): error C3861: 'fm': identifier not found 1>tasker.cpp(103): error C2065: 'mapped_region' : undeclared identifier 1>tasker.cpp(103): error C2146: @L_607_1@ error : missing ';' before identifier 'region' 1>tasker.cpp(103): error C2065: 'fm' : undeclared identifier 1>tasker.cpp(103): error C2065: 'read_only' : undeclared identifier 1>tasker.cpp(103): error C3861: 'region': identifier not found 1>tasker.cpp(105): error C2065: 'region' : undeclared identifier 1>tasker.cpp(105): error C2228: left of '.get_address' must have class/struct/union 1> type is 'unkNown-type' 1>tasker.cpp(106): error C2065: 'region' : undeclared identifier 1>tasker.cpp(106): error C2228: left of '.get_size' must have class/struct/union 1> type is 'unkNown-type'
并为#include< boost / interprocess / mapped_region.hpp>我正进入(状态
1>C:\Users\Mike\Documents\boost_1_55_0\boost/intrusive/detail/has_member_function_callable_with.hpp(200): error C2228: left of '.SELEct_on_container_copy_construction' must have class/struct/union 1> type is 'boost::move_detail::add_rvalue_reference<U>::type' 1> C:\Users\Mike\Documents\boost_1_55_0\boost/intrusive/detail/has_member_function_callable_with.hpp(276) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_SELEct_on_container_copy_construction_impl<Fun,true,>' being compiled 1> with 1> [ 1> Fun=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>> 1> ] 1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/allocator_Traits.hpp(262) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_SELEct_on_container_copy_construction<const Alloc,>' being compiled 1> with 1> [ 1> Alloc=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const,void *>>>>> 1> ] 1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/detail/tree.hpp(217) : see reference to class template instantiation 'boost::container::allocator_Traits<A>' being compiled 1> with 1> [ 1> A=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const,void *>>>>> 1> ] 1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/detail/tree.hpp(246) : see reference to class template instantiation 'boost::container::container_detail::intrusive_rbtree_type<A,boost::container::container_detail::tree_value_compare<Key,std::pair<const Key,T>,Compare,boost::container::container_detail::SELEct1st<std::pair<const Key,T>>>>' being compiled 1> with 1> [ 1> A=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const,void *>>>>> 1>,Key=const boost::interprocess::ipcdetail::sync_id * 1>,T=boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>> 1>,Compare=boost::interprocess::ipcdetail::sync_handles::address_less 1> ] 1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/map.hpp(83) : see reference to class template instantiation 'boost::container::container_detail::rbtree<Key,T>>,Allocator>' being compiled 1> with 1> [ 1> Key=const boost::interprocess::ipcdetail::sync_id * 1>,Compare=boost::interprocess::ipcdetail::sync_handles::address_less 1>,Allocator=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const,void *>>>>> 1> ] 1> C:\Users\Mike\Documents\boost_1_55_0\boost/interprocess/sync/windows/sync_utils.hpp(226) : see reference to class template instantiation 'boost::container::map<const boost::interprocess::ipcdetail::sync_id *,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<T>>,boost::interprocess::ipcdetail::sync_handles::address_less,std::allocator<std::pair<const Key,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<T>>>>>' being compiled 1> with 1> [ 1> T=std::pair<const boost::interprocess::ipcdetail::sync_id,void *> 1>,Key=const boost::interprocess::ipcdetail::sync_id * 1> ]
我正在使用Visual studio Express 2013 for Windows Desktop,并提升1.55.0.
我尝试了其他的boost库并且没有任何问题….而且,我正在使用X64版本构建.
或者:
>使用Visual studio 2012工具链
>或尝试从svn co http://svn.boost.org/svn/boost/trunk boost-trunk获取最新资源
>或补丁提升自己(别忘了upload your patch)
>或者等到有人修补它.你可以在submitting bug report之前加快速度
编辑
刚检查了boost-trunk,已经修补了boost / intrusive / detail / has_member_function_callable_with.hpp,它与vs2013和vs2013-nov-2013-ctp工具链编译得很好.所以,试试吧.而且,如果您有多个boost版本,请不要忘记像我一样更改包含路径(在Makefile或VC项目属性中).
以上是大佬教程为你收集整理的c – Boost编译器错误?全部内容,希望文章能够帮你解决c – Boost编译器错误?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。