I wasted my whole day trying to find this silly error but didn't get through
I am trying to compile
these are the header filesCode:/* file: filesearch.c */ #include <string.h> #include <windows.h> #include "filesearch.h" #include "stack.h" void getCurrentPath(char *path) { GetCurrentDirectory(MAX_PATH,path); } void searchpath(char *path,char *pattern,struct strData **filestack) { HANDLE hsearch; WIN32_FIND_DATA FileData; char tempdata[MAX_PATH]; struct stkData *dirstack,tempstack; initstack(&dirstack); initstack(filestack); if(SetCurrentDirectory(path)){ if((hsearch=FindFirstFile(pattern,&FileData)) != INVALID_HANDLE_VALUE){ do{ if(!(FileData.cFileName == "." || FileData.cFileName == "..")){ if (FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY){ strncpy(tempstack.data,FileData.cFileName,strlen(FileData.cFileName)); push(&dirstack,tempstack); }else{ strncpy(tempstack.data,FileData.cFileName,strlen(FileData.cFileName)); push(filestack,tempstack); } } }while(FindNextFile(hsearch, &FileData)); FindClose(hsearch); } while(!isEmpty(&dirstack)){ tempstack = pop(&dirstack); searchpath(tempstack.data,pattern,filestack); } } }
Code:#ifndef _FILESEARCH_H #define _FILESEARCH_H void getCurrentPath(char *); void searchpath(char *,char *,struct strData **); #endifI am getting this errorCode:#ifndef _STACK_H #define _STACK_H #define PATHLENGTH 260 struct stkData{ char data[PATHLENGTH]; int status; struct stkData *next; }; void initstack(struct stkDat..........); int isEmpty(struct stkDat..........); void push(struct stkDat..........,struct stkData); struct stkData pop(struct stkDat..........); #endif
Code:D:\Project\C\stack>lcc filesearch.c Error filesearch.c: 14 redeclaration of 'searchpath' previously declared at d:\project\c\stack\filesearch.h 4 1 errors, 0 warnings



LinkBack URL
About LinkBacks


