discodowney
discodowney

Reputation: 1507

dirent.h casuing problems with ShellAPI.h

I have a function:

SHFileOperationFunc(string item1, string item2, int operation, CuTest *tc)

It is used to do operations (move, delete or copy) directories. It works fine. But i am now trying to use stuff from dirent.h. When I include the file it causes huge problems with stuff from ShellAPI.h I use in SHFileOperationFunc. I got dirent.h as per http://www.softagalleria.net/dirent.php.

After I include the file I get errors like:

error C2065: 'FO_DELETE' : undeclared identifier
error C2065: 'FO_COPY' : undeclared identifier
error C2065: 'FO_DELETE' : undeclared identifier
error C2065: 'FO_DELETE' : undeclared identifier

These are defined in ShellAPI.h. When I hover over them in VS it says the value they have so it is seeing them. Anyone know why including this file is having this effect?

Upvotes: 0

Views: 214

Answers (1)

Hans Passant
Hans Passant

Reputation: 941545

Using dirent.h on a Windows machine is unadvisable, it is a Unix header. The file you downloaded screws up the rest of your #includes. Either put if after #include <windows.h> or edit the file and delete the #define for WIN32_LEAN_AND_MEAN. Putting that in a header is, well, mean. It causes a large number of declarations to be skipped in the Windows headers.

Upvotes: 2

Related Questions