У меня проблема со временем компиляции. Новичок в C ++, так что я уверен, что все просто. Я получаю текущую ошибку.
diarydb.cpp: In function ‘bool editdate(int, mysqlpp::Connection&)’: diarydb.cpp:413:
error: ‘format_tests’ has not been declared
но diardby.cpp Я объявил format_tests здесь
namespace format_tests {
bool testdateformat(string &date);
bool tesettimeformat(string &time);
bool lengthcheck(string &in,int length);
}
с
bool format_tests::testdateformat(string &date){
// tests format of dat input for MYSQL form at of YYYY-MM-DD
// Need to tweak regex to restrict 0 < MM < 12 and 0 < DD <31.
const boost::regex e("\\d{4}\\x2D\\d{2}\\x2D\\d{2}");
return boost::regex_match(date,e);
}
компилятор вызова здесь.
bool dbsetget::editdate(int e_id,mysqlpp::Connection &con){
char evdate[11];
cout << "Input start time" << endl;
cin.getline(evdate,11,'\n'); // restrict legth of input with getline.lenght of input
string date = evdate;
if (format_tests::testdateformat(date)){
mysqlpp::Query query = con.query();
query <<"UPDATE main SET date="<< quote_only << date <<"WHERE d_Id ="<< e_id;
return query.exec();
}
else
{
cerr << "Date not in correct format. YYYY-MM-DD ";
return false;
};
}
Я не понимаю, в чем проблема? Я объявил пространство имен format_tests Может кто-нибудь, пожалуйста, направлять меня?
Я уверен, что и здесь есть много ошибок, но эта из-за этого меня сильно смутила.