|
发表于 2019-4-20 18:14:49
|
显示全部楼层
我直接对照着输入的会报以下错误,把下面的代码直接从测试代码复制过去就没有错误了,怎么回事?
- void findALLCodes(const char *path)
- {
- struct _finddata_t fa;
- long handle;
- char thePath[MAX], target[MAX];
-
- strcpy(thePath, path);
- if((handle = _findfirst(strcat(thePath, "/*.c"), &fa)) != -1L)
- {
- do
- {
- sprintf(target, "%s/%s", path, fa.name);
- total += countLines(target);
- }while (_findnext(handle, &fa) == 0);
- }
-
- _findclose(handle);
- }
- void findALLDirs(const char *path)
- {
- struct _finddata_t fa;
- long handle;
- char thePath[MAX];
-
- strcpy(thePath, path);
- if((handle = _findfirst(strcat(thePath, "/*"), &fa)) == -1L)
- {
- fprintf(stderr, "The path %s is wrong!\n",path);
- return;
- }
-
- do
- {
- if(!strcmp(fa.name, ".") || !strcmp(fa.name, ".."))
- continue;
-
- if(fa.attrib == _A_SUBDIR)
- {
- sprintf(thePath, "%s/%s", path, fa.name);
- findALLCodes(thePath);
- findALLDirs(thePath);
- }
- }while (_findnext(handle, &fa) == 0);
-
- _findcolse(handle);
- }
- C:\Users\ADMINI~1\AppData\Local\Temp\ccoO0gKA.o SLE2kehou.c:(.text+0x2f3): undefined reference to `_findcolse'
- C:\Users\ADMINI~1\AppData\Local\Temp\ccoO0gKA.o SLE2kehou.c:(.text+0x348): undefined reference to `findAllCodes'
- C:\Users\Administrator\Desktop\tset\collect2.exe [Error] ld returned 1 exit status
复制代码
|
|