TSearchRec 로 선언한 변수를 FindClose 함수에 쓸때
다음과 같은 에러가 발생하는 경우
Incompatible types: "Cardinal" and "TSearchRec"
해결방법 :
uses 절에 SysUtils 보다 앞에 Windows 를 사용하면 해결
FindFirst, FindNext, FindClose Seems I've used the above routines with a TSearchRec several times before. I'm now having trouble getting FindClose(SomeSearchRec) to compile. The compile time error message is: Incompatible types: "Cardinal" and "TSearchRec" Seems the compiler is finding the FindClose routine in the Windows unit, but not the one in the SysUtils unit. How can I make the compiler recognize the SysUtils FindClose? Both SysUtils and Windows are in my uses clause. What I've done is take the routine DeleteEmptyFiles in this post ([link]http://www.delphipages.com/threads/thread.cfm?ID=169202&G=169198[/link]), which must have compiled when I created it (I think - can't find my disk's version of that code) and pasted it to a general unit where I save a bunch of routines. Now FindClose causes an error. jdg.ho I love this forum. Your generosity is wonderful. |
#2 | |||
| |||
RE: FindFirst, FindNext, FindClose Solved it, but still have a question. I simply rearranged the uses clause to put Windows before SysUtils. Now it compiles with no error. Can anyone tell me why this ordering matters? jdg.ho I love this forum. Your generosity is wonderful. |