C++ 错误c2244 dlib贝叶斯网络示例代码

C++ 错误c2244 dlib贝叶斯网络示例代码,c++,bayesian-networks,C++,Bayesian Networks,我试图运行visual studio 2013中提供的示例代码,设置了所有库,但在方法元素和元素常量处出现了两个c2244错误 这是错误报告 1>------ Build started: Project: bayesian, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> bayesian.cpp 1>c:\program files (x86)\microsoft visual studio 12.0\vc\i

我试图运行visual studio 2013中提供的示例代码,设置了所有库,但在方法元素和元素常量处出现了两个c2244错误

这是错误报告

1>------ Build started: Project: bayesian, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  bayesian.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\dlib\binary_search_tree\binary_search_tree_kernel_c.h(187): error C2244: 'dlib::binary_search_tree_kernel_c<bst_base>::element' : unable to match function definition to an existing declaration
1>          definition
1>          'const dlib::map_pair<bst_base::domain_type,bst_base::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void) const'
1>          existing declarations
1>          'dlib::map_pair<binary_search_tree_kernel_c<bst_base>::::domain_type,binary_search_tree_kernel_c<bst_base>::::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void)'
1>          'const dlib::map_pair<binary_search_tree_kernel_c<bst_base>::::domain_type,binary_search_tree_kernel_c<bst_base>::::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void) const'
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\dlib\binary_search_tree\binary_search_tree_kernel_c.h(205): error C2244: 'dlib::binary_search_tree_kernel_c<bst_base>::element' : unable to match function definition to an existing declaration
1>          definition
1>          'dlib::map_pair<bst_base::domain_type,bst_base::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void)'
1>          existing declarations
1>          'dlib::map_pair<binary_search_tree_kernel_c<bst_base>::::domain_type,binary_search_tree_kernel_c<bst_base>::::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void)'   
1>          'const dlib::map_pair<binary_search_tree_kernel_c<bst_base>::::domain_type,binary_search_tree_kernel_c<bst_base>::::range_type> &dlib::binary_search_tree_kernel_c<bst_base>::element(void) const'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1>----构建已启动:项目:贝叶斯,配置:调试Win32------
1> stdafx.cpp
1> bayesian.cpp
1> c:\program files(x86)\microsoft visual studio 12.0\vc\include\dlib\binary\u search\u tree\binary\u search\u tree\u kernel\u c.h(187):错误C2244:“dlib::binary\u search\u tree\u kernel\u c::element”:无法将函数定义与现有声明匹配
1> 定义
1> 'const dlib::map\u pair&dlib::binary\u search\u tree\u kernel\u c::element(void)const'
1> 现有声明
1> 'dlib::map_pair&dlib::binary_search_tree_kernel_c::element(void)'
1> 'const dlib::map\u pair&dlib::binary\u search\u tree\u kernel\u c::element(void)const'
1> c:\program files(x86)\microsoft visual studio 12.0\vc\include\dlib\binary\u search\u tree\binary\u search\u tree\u kernel\u c.h(205):错误C2244:“dlib::binary\u search\u tree\u kernel\u c::element”:无法将函数定义与现有声明匹配
1> 定义
1> 'dlib::map_pair&dlib::binary_search_tree_kernel_c::element(void)'
1> 现有声明
1> 'dlib::map_pair&dlib::binary_search_tree_kernel_c::element(void)'
1> 'const dlib::map\u pair&dlib::binary\u search\u tree\u kernel\u c::element(void)const'
======生成:0成功,1失败,0最新,0跳过==========

我看不出这里出了什么问题

这是visual studio 2013中的一个bug。您可以通过将二进制搜索树内核c.h中的两个element()函数的定义从类外部移动到类内部来解决这个问题