ошибка c2244 пример кода байесовской сети dlib

я пытаюсь запустить пример кода, представленного здесь http://dlib.net/bayes_net_ex.cpp.html В Visual Studio 2013 все библиотеки настроены, но я получаю две ошибки c2244 в методе element и element const.

вот сообщение об ошибке

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 ==========

я не могу понять, что здесь не так.

0

Решение

Это ошибка в Visual Studio 2013. Вы можете обойти ее, переместив определения двух функций element () в binary_search_tree_kernel_c.h из-за пределов класса внутрь класса.

0

Другие решения

Других решений пока нет …