I am trying to compile this project Realtimebattle reloaded (github).
But the gcc throws weird error:
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 ) ) )
And the source code is:
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);
}
}
I am very confused with the log.
答案 0 :(得分:0)
The original version didn't use CMake: https://github.com/ezag/realtimebattle
This is probably an incomplete port over to the CMake build system.
What's happening here is the code depends on macros being defined during compile-time.
Placing: '#define HAVE_DIRENT_H' at the top of Various.cc will probably make that part of the code compile... but there are probably more issues than just that one case.