저는 C++을 처음 사용합니다. 나는 B + 트리를 구현했고 Macbook (CLion 포함)에서 잘 작동하지만 우분투 서버에서 실행하면 아래에 컴파일 오류가 발생합니다. 누군가 제발 도와 드릴까요? 의오류 : 호출 C와 일치하는 함수가 없습니다.
error: no matching function for call to
‘std::vector<std::__cxx11::basic_string<char>
>::vector(__gnu_cxx::__normal_iterator<const
std::__cxx11::basic_string<char>*,
std::vector<std::__cxx11::basic_string<char> > >,
std::vector<std::__cxx11::basic_string<char> >::iterator)’
결과 g ++ -v 맥 :
로 구성 : --prefix =/라이브러리/개발자/CommandLineTools는/usr --with-Gxx라는-포함-DIR =는/usr/포함/C++/4.2.1 애플 LLVM 버전 9.0.0 (그 소리-900.0.38) 대상 : x86_64에-사과 darwin16.7.0 스레드 모델 : POSIX InstalledDir :/라이브러리/개발자/CommandLineTools는/usr/빈에게
우분투 서버에서 g ++ -v의 결과 :
오류가 발생합니다 GCC 버전 5.4.0 20160609 (우분투 5.4.0-6ubuntu1 ~ 16.04.5)코드 스 니펫은
:
std::pair<InternalNode *, Node *> split(int order) {
std::vector<float>::const_iterator old_dn_keys_end = keys.begin() + ceil(float(order)/2) - 2;
std::vector<std::string>::const_iterator old_dn_values_end = values.begin() + ceil(float(order)/2) - 2;
new_dn->keys = std::vector<float>(old_dn_keys_end + 1, keys.end());
//**--- error here ---**
new_dn->values = std::vector<std::string>(old_dn_values_end + 1,
values.end());
//rest of the code...
}