我得到我在標題中提到的錯誤,當我嘗試編譯下面的代碼:C++錯誤:Wunused,但設置變量
void Sql::select(const string table, const string column, const string condition, const string condition_2, const string condition_3) {
otl_stream s;
otl_column_desc* desc;
int desc_len;
const string select = str(format("SELECT %2% FROM %1% WHERE LEFT(%3%, 8) < %6% AND %4% = 'Ausstehend' AND (%5% = '1' OR %5% = '2') ")
% table % column % condition % condition_2 % condition_3 % getDate());
// cout << select;
try {
s.open(10, select.c_str(), con);
} catch (otl_exception &e) {
cerr << e.msg;
}
desc = s.describe_select(desc_len);
}
,有人告訴我otl_column_desc *遞減設置但未使用。你能告訴我哪裏出了問題嗎?
您正在捕獲「desc」中s.describe_select的返回值,但是您沒有對任何東西使用desc。如果你不打算使用它,你也可以放棄這個返回值。 – crowder