请修复这个错误:cc7417 error struct dirent has no member named d_type; did you mean d_name if dp-d_type == DT_DIR ^~~~~~ d_name cc7427 error DT_DIR undeclared first
将代码中的d_type改为d_name,将DT_DIR改为DIR,将DT_REG改为REG:
c.c:74:17: error: 'struct dirent' has no member named 'd_type'; did you mean 'd_name'? if (dp->d_name == DIR) { ^~~~~~ d_name c.c:74:27: error: 'DIR' undeclared (first use in this function); did you mean 'd_name'? if (dp->d_name == DIR) { ^~~ d_name c.c:74:27: note: each undeclared identifier is reported only once for each function it appears in c.c:76:24: error: 'struct dirent' has no member named 'd_type'; did you mean 'd_name'? } else if (dp->d_name == REG) { ^~~~~~ d_name c.c:76:34: error: 'REG' undeclared (first use in this function) } else if (dp->d_name == REG) {
原文地址: https://www.cveoy.top/t/topic/bubm 著作权归作者所有。请勿转载和采集!