我在监控目录下文件的软件中使用了ReadDirectoryChangesW(.....)
但是我在编译,链接时出现错误:
--------------------Configuration: ECMMonitor - Win32 Debug--------------------
Compiling...
FileSystemWatcher.cpp
D:\VCspace\ECMMonitor060905\FileSystemWatcher.cpp(98) : error C2065: 'ReadDirectoryChangesW' : undeclared identifier
Error executing cl.exe.
Creating browse info file...ECMMonitor.exe - 1 error(s), 0 warning(s)我引用的头文件如下:
#define UNICODE
#define _WIN32_WINNT 0x0500
#include "StdAfx.h"
#include "FileSystemWatcher.h"
#include "ECMMonitor.h"
#include <windows.h>
#include <cassert>
#include <AFXTEMPL.H>
#include "SplitStr.h"
#include "iostream.h"
我还需要什么文件.我把MSDN上的例子拿来运行也有错误。
我的运行环境是WindowsXP SP2
请高手指教!

解决方案 »

  1.   

    少了头文件 , 你的IDE 的版本应该比较低了  vc6 吧 ?
      

  2.   

    试一下在stfafx.h中加入#define _WIN32_WINNT 0x0400
      

  3.   

    to Solike:
    我加了。还是不行。
    to cenchure:
    我用的是VC6。但是,我从网上找了些例子,也用到了ReadDirectoryChangesW(),就可以编译、连接、运行。我把例子中引用的头文件都用在我的程序中,还是说“error C2065: 'ReadDirectoryChangesW' : undeclared identifier”。
    请高手关注!我网上搜索,我一直没有找到答案。
      

  4.   

    问题复杂了!
    我在stfafx.cpp中加了#include <WINBASE.H>后运行成功,于是我又把#include <WINBASE.H>删掉,运行还是成功!这是为何???
    请高手指点迷津!!!
      

  5.   

    呼呼,可能你前后定义“#define UNICODE”不一致,用了W版了。用“ReadDirectoryChangesA(.....)”版试试。