Я воспроизвел эту ошибку компилятора со следующим (main.cpp
):
#include <vector>
#include <string>
int main()
{
std::vector<std::string> v;
v.push_back(std::string("test"));
return 0;
}
Команда компилятора:
g++ -fno-implicit-templates main.cpp -o main
Компилируется, если не указана опция -fno-implicit-templates
.
Проверьте, указан ли флаг компилятора -fno-implicit-templates
, и снимите его, если это возможно.
Для сборки с -fno-implicit-templates
я изменил источник на:
#include <vector>
#include <string>
//class template std::vector<std::string>; TYPO here: 'class' & 'template' wrong order
template class std::vector<std::string>;
int main()
{
std::vector<std::string> v;
v.push_back(std::string("test"));
return 0;
}
РЕДАКТИРОВАТЬ:
Я скачал mysql 5.1.60 и успешно собрал его, используя команды configure
и make
, которые вы указали в комментарии.
Затем я отредактировал файл "sql_parse.cc" какследует:
// Added these include directives before any other.
#include <vector>
#include <string>
// At the end of include directives added this explicit template
// instantiation.
template class std::vector<std::string>;
// Added the following lines into a random function.
std::vector<std::string> v;
v.push_back(std::string("1"));
Затем я снова запустил make
, и он успешно скомпилирован и связан.Обратите внимание, что я скомпилировал с -fno-implicit-templates
: я не сделал никаких других изменений в дистрибутиве mysql, кроме тех, что я сделал в "sql_parse.cc".