0
我想編譯這個項目Realtimebattle reloaded (github)。錯誤:無法將'dirent *'轉換爲'search_directories(std :: string,std :: list <start_tournament_info_t *>&,bool):: direct *'
但GCC拋出奇怪的錯誤:
RealTimeBattle_reloaded/RealtimeBattle/original_gtk/src/Various.cc:473:30: error: cannot convert ‘dirent*’ to ‘search_directories(std::string, std::list<start_tournament_info_t*>&, bool)::direct*’ in assignment
while(NULL != (entry = readdir(dir)))
和源代碼是:
void
search_directories(string directory,
list<start_tournament_info_t*>& tour_list,
const bool check_robots)
{
bool err_in_file = false;
DIR* dir;
if(NULL != (dir = opendir(directory.c_str())))
{
struct dirent* entry;
while(NULL != (entry = readdir(dir)))
{
string full_file_name = directory + entry->d_name;
bool res = false;
if(check_robots)
res = check_if_filename_is_robot(full_file_name, &err_in_file);
else
res = check_if_filename_is_arena(full_file_name, &err_in_file);
if(res)
{
start_tournament_info_t* info;
info = new start_tournament_info_t(0, false, full_file_name, "");
tour_list.push_back(info);
}
}
closedir(dir);
}
}
我很困惑與日誌。
您確定自己發佈的代碼和錯誤與您在本地看到的內容相符嗎?你寫了兩次錯誤引用了'direct'而不是'dirent',但是你的發佈代碼沒有使用前一種類型。這個錯字是否存在於原始代碼中?如果沒有,請生成併發布[MCVE](http://stackoverflow.com/help/mcve)。 – jerry