简体   繁体   English

使用升压示例时出现错误C4996

[英]Error C4996 on using boost example

I have installed Boost 1.58.0 following their instructions and the examples they give in the installation guide work fine using VS2012. 我已经按照他们的说明安装了Boost 1.58.0,并按照VS2012在安装指南中给出的示例正常工作。 I also have OpenCV3.0.0 included in my properties. 我的属性中还包含OpenCV3.0.0。 I want to check out an example of some graphing functions, so I copied this code: http://www.boost.org/doc/libs/1_58_0/libs/graph/example/astar_maze.cpp , and included stdafx.h on the top. 我想查看一些图形功能的示例,因此我复制了以下代码: http : //www.boost.org/doc/libs/1_58_0/libs/graph/example/astar_maze.cpp ,并在其中包含了stdafx.h顶端。

When compiling, I get 编译时,我得到

error C4996: 'std::_Fill_n': Function call with parameters that may be unsafe

Other people suggest either using 其他人建议使用

#pragma warning( disable : 4996 )

which doesn't seem to change anything, or turning off SDL checks via properties, which turns the error into a warning, but gives me many more errors, mostly LNK2005. 这似乎并没有改变任何东西,也没有通过属性关闭SDL检查,这将错误变成警告,但给了我更多错误,主要是LNK2005。

Any ideas how to get the code running? 任何想法如何使代码运行?

Additional info: Types of error when turning off SDL checks are (my project is BoostExample): 附加信息:关闭SDL检查时的错误类型是(我的项目是BoostExample):

error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in BoostExample.obj
error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in opencv_ts300d.lib(ts_perf.obj)
error LNK2005: ___crtSetUnhandledExceptionFilter already defined in MSVCRTD.lib(MSVCR110D.dll)

and finally 最后

fatal error LNK1169: one or more multiply defined symbols found

I guess this means that Boost is interacting with OpenCV and other DLLs by redefining something. 我想这意味着Boost通过重新定义某些东西来与OpenCV和其他DLL进行交互。 Is it possible that I installed the wrong boost version? 我可能安装了错误的Boost版本吗? I just grabbed the main one. 我只是抓住了主要的。

The linker error tells basically the boost and the OpenCV were compiled off using different runtime settings, one for static lib and the other for DLL, and cannot be mixed used. 链接器错误基本上表明boost和OpenCV是使用不同的运行时设置编译的,一个用于静态lib,另一个用于DLL,并且不能混合使用。 you need to rebuild your boost and OpenCV to use same runtime setting. 您需要重建boost和OpenCV以使用相同的运行时设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM