九月授衣 发表于 2022-2-14 21:37:58

第一个课后作业。对着抄都不知道错在哪里,求大佬解答

本帖最后由 九月授衣 于 2022-2-15 10:53 编辑


- makefile处理器: C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\mingw32-make.exe
- 命令: mingw32-make.exe -f "C:\Users\86191\Desktop\c\Makefile.win" all

C:\Users\86191\Desktop\c\Makefile.win:31: warning: overriding recipe for target '作业一.o'

C:\Users\86191\Desktop\c\Makefile.win:28: warning: ignoring old recipe for target '作业一.o'
gcc.exe -c 作业一.c -o 作业一.o -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"

作业一.c: In function 'findALLCodes':

作业一.c:33:2: error: unknown type name 'struct_finddate_t'
struct_finddate_t fa;
^
作业一.c:37:38: error: expected ')' before string constant
if((handle=_findfirst(strcat(thePath"/*.c"),&fa))!=-1l)
                                    ^
作业一.c:37:24: error: too few arguments to function 'strcat'
if((handle=_findfirst(strcat(thePath"/*.c"),&fa))!=-1l)
                        ^
作业一.c:37:46: warning: passing argument 2 of '_findfirst64i32' from incompatible pointer type
if((handle=_findfirst(strcat(thePath"/*.c"),&fa))!=-1l)
                                              ^
In file included from 作业一.c:1:0:
C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/io.h:220:20: note: expected 'struct _finddata64i32_t *' but argument is of type 'int *'
   intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
                  ^
作业一.c:41:34: error: request for member 'name' in something not a structure or union
    sprintf(target,"%s/%s",path,fa.name);
                                  ^
作业一.c:43:27: warning: passing argument 2 of '_findnext64i32' from incompatible pointer type
   }while(_findnext(handle,&fa)==0);
                           ^
In file included from 作业一.c:1:0:
C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/io.h:241:15: note: expected 'struct _finddata64i32_t *' but argument is of type 'int *'
   int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
               ^
作业一.c: In function 'findALLDirs':
作业一.c:49:2: error: unknown type name 'struct_finddate_t'
struct_finddate_t fa;
^
作业一.c:53:31: error: 'thePath' undeclared (first use in this function)
if((handle=_findfirst(strcat(thePath,"/*"),&fa))==-1l)
                               ^
作业一.c:53:31: note: each undeclared identifier is reported only once for each function it appears in
作业一.c:53:45: warning: passing argument 2 of '_findfirst64i32' from incompatible pointer type
if((handle=_findfirst(strcat(thePath,"/*"),&fa))==-1l)
                                             ^
In file included from 作业一.c:1:0:
C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/io.h:220:20: note: expected 'struct _finddata64i32_t *' but argument is of type 'int *'
   intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData);
                  ^
作业一.c:55:43: error: expected ')' before 'path'
   fprintf(stderr,"The path %s is wrong!\n"path);
                                           ^
作业一.c:60:16: error: request for member 'name' in something not a structure or union
   if(!strcmp(fa.name,".")||!strcmp(fa.name,".."))
                ^
作业一.c:60:38: error: request for member 'name' in something not a structure or union
   if(!strcmp(fa.name,".")||!strcmp(fa.name,".."))
                                    ^
作业一.c:62:8: error: request for member 'attrib' in something not a structure or union
   if(fa.attrib==_A_SUBDIR)
      ^
作业一.c:64:35: error: request for member 'name' in something not a structure or union
    sprintf(thepath,"%s/%s",path,fa.name);
                                 ^
作业一.c:68:26: warning: passing argument 2 of '_findnext64i32' from incompatible pointer type
}while(_findnext(handle,&fa)==0);
                        ^
In file included from 作业一.c:1:0:
C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include/io.h:241:15: note: expected 'struct _finddata64i32_t *' but argument is of type 'int *'
   int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData);
               ^
作业一.c: In function 'main':
作业一.c:80:1: error: expected ';' before '}' token
}
^
C:\Users\86191\Desktop\c\Makefile.win:31: recipe for target '作业一.o' failed
mingw32-make.exe: *** [作业一.o] Error 1


编译结果...
--------
- 错误: 12
- 警告: 6

阿萨德按时 发表于 2022-2-15 11:03:36

你这代码没发完整吧

阿萨德按时 发表于 2022-2-15 11:30:17

其实无非就是大小写,少标点或者括号,单词拼写错误什么的,仔细对照肯定可以发现

九月授衣 发表于 2022-2-16 12:14:11

阿萨德按时 发表于 2022-2-15 11:30
其实无非就是大小写,少标点或者括号,单词拼写错误什么的,仔细对照肯定可以发现

从头到尾看了几遍,确实是这个问题
页: [1]
查看完整版本: 第一个课后作业。对着抄都不知道错在哪里,求大佬解答