Unsafe code may only appear if compiling with /unsafe
来源:互联网 发布:浙江围棋 知乎 编辑:程序博客网 时间:2024/06/05 15:33
1、用VS2005,C++使用GDAL的动态库时,报编译错误
Error 28 error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: __thiscall std::_Vector_const_iterator<struct GDALColorEntry,class std::allocator<struct GDALColorEntry> >::_Vector_const_iterator<struct GDALColorEntry,class std::allocator<struct GDALColorEntry> >(struct GDALColorEntry *,class std::_Container_base const *)" (??0?$_Vector_const_iterator@UGDALColorEntry@@V?$allocator@UGDALColorEntry@@@std@@@std@@QAE@PAUGDALColorEntry@@PBV_Container_base@1@@Z) match1.obj
解决方法:Configuration Properties -> C/C++ -> Code Generation -> Runtime Library, make sure this is set to either "Multi-Threaded Debug DLL (/MDd)" if you are linking with the dll runtime or "Multi-Threaded Debug (/MTd)" if you are statically linking with the runtime.
2、用VS2005编译SharpMap/Branches/0.9.5中的SharpMap.Extensions时报错“Error103Unsafe code may only appear if compiling with /unsafe”
解决方法:在工程属性中勾选“Allow Unsafe code”
3、VS2008无法捕捉到断点,调试的时候原来的断点处显示一个空心圆加一个右下角的警告图标的解决方案。
今天(2013年9月18日,牢记历史!)本来写代码调试得好好的,突然加了一句话以后无法调试了,原来红红的断点处在调试的时候变成了空心圆加一个右下角的警告图标,如果临时让断点生效,可以选择右键点击断点,Location,把Allow Source code to be different这个选项勾上,但是编译的时候又提示“the source file is different from when the module was built”,虽然点确定也能过去,但是问题始终是没有解决的,感觉应该是修改代码以后IDE不知哪里没更新,导致它认为两份源代码不一样
解决方案:
Tools-Options,选中Debugging选项卡,里面有个“Require source to exactly match...”的勾先去掉,然后稍微修改下代码,保存后,再把勾勾上,这样就好了。
4、VS2008在处理字符串的时候报错“”Error 4error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'char [1024]' to 'LPCWSTR'
这种涉及到普通字符转换为宽字符(W)的时候,需要在项目属性里Configuration Properties——General——Character Set,改为Use Multi-Byte Character Set,这样就不报错了,就可以通用了。
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- Unsafe code may only appear if compiling with /unsafe
- Unity3D MonoDevelop unsafe code may only appear if compiling with /unsafe
- C# 不安全代码如何可以正常编译(unsafe code may only appear if compiling with/unsafe)
- Unsafe
- Unsafe
- Unsafe
- 关于使用Unsafe code
- CSharp - Unsafe code
- C# unsafe code
- C# unsafe code
- babel & browserify 报错 'import' and 'export' may appear only with 'sourceType: module' (2:0)
- error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe
- C++:error C4996: 'std::_Uninitialized_copy0': Function call with parameters that may be unsafe
- C++:error C4996: 'std::_Uninitialized_copy0': Function call with parameters that may be unsafe
- 整数 向上取整算法:(x+n-1)/n
- 常用
- 男女网购的不同给我们带来的思考
- CUDA存储器模型
- 解决删除nsuserdefault全部内容后创建uiwebview挂机
- Unsafe code may only appear if compiling with /unsafe
- Ubuntu编辑命令vi大全(转自百度文库)
- 七款Debug工具推荐:iOS开发必备的调试利器
- 将Mac OS X从Snow Leopard升级到Mountain Lion
- iOS 圆形旋转托盘
- 通用数据库连接工具介绍
- MyEclipse下安装SVN 插件的亲测可用的办法
- MSHflexgrid控件删除选中行
- mysql存过拼接字符当表面问题