Solved

compiling a call to FindNextFileEx fails...

Posted on 2003-11-02
14
714 Views
Last Modified: 2013-11-20
Hi,

when I'm trying to compile a call to FindFirstFileEx I get compiling errors. The call looks like this:

WIN32_FIND_DATA ffd;
FindFirstFileEx( m_FileName,
                 FindExInfoStandard,
                 ffd,
                 FindExSearchNameMatch,
                 NULL,
                 0 );

I get these errors:

error C2065: 'FindFirstFileEx' : undeclared identifier
error C2065: 'FindExInfoStandard' : undeclared identifier
error C2065: 'FindExSearchNameMatch' : undeclared identifier

The compiler can neither find the function, the enumeration FINDEX_INFO_LEVELS or the enumeration FINDEX_SEARCH_OPS, which it should since they're all definded in winbase.h, and calls made to the functions

FindFirstFile(), FindNextFile() and FindClose()  (which also are declared in winbase.h)

succeeds without any errros.

Can anyone help please?

/Nick
0
Comment
Question by:Nick_72
  • 6
  • 3
  • 2
  • +2
14 Comments
 
LVL 86

Assisted Solution

by:jkr
jkr earned 50 total points
ID: 9666654
Try to

#define _WIN32_WINNT 0x0400

before including the headers, as the declarations you are mentioning are guarded by

#if(_WIN32_WINNT >= 0x0400)
0
 
LVL 9

Author Comment

by:Nick_72
ID: 9666661
Thanks,

but I've already tried that - with the same result...

/Nick
0
 
LVL 86

Expert Comment

by:jkr
ID: 9666703
Have you made sure the above appears before the inclusion of _any_ header files and performed a "Rebuild All"?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 9

Author Comment

by:Nick_72
ID: 9666773
Yes I have. Strange isn't it?
0
 
LVL 9

Author Comment

by:Nick_72
ID: 9666830
Actually, when I write FindNextFileEx and hit the '(' sign, I get the tooltip with the parameters, so it knows about the function. However, I get these compiler errors... :(
0
 
LVL 9

Author Comment

by:Nick_72
ID: 9666889
I'm sorry if I'm confusing, I'm a little tired, I see that I keep mixing FindNextFileEx and FindFirstFileEx.....

I mean of course FindFirstFileEx,

there's no such thing as FindNextFileEx.

I couldn't find any edit links to the messages.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 50 total points
ID: 9667529
Open up the file name
        stdafx.h
Insert this line:
       #define _WIN32_WINNT 0x0400
directly above this line:
       #define VC_EXTRALEAN
and rebuild.

That will work, or I'll eat my hat.
-- Dan
0
 
LVL 7

Expert Comment

by:vijay_visana
ID: 9668821
msdn says it is Unsupported in Windows 95/98
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 50 total points
ID: 9669292
Insert #define _WIN32_WINNT 0x0400 into stdafx.h before #define WIN32_LEAN_AND_MEAN      and comment #define WIN32_LEAN_AND_MEAN:

#define _WIN32_WINNT 0x0400

//#define WIN32_LEAN_AND_MEAN            // Exclude rarely-used stuff from Windows headers    !!!!

#include <windows.h>

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9674717
One other point...
In the example code, you are setting options for FindFirstFileEx that just simulate using FindFirstFile.  

So why not just use that?

-- Dan
0
 
LVL 7

Expert Comment

by:vijay_visana
ID: 9676375
if you're not using 98x then try to update sdk.
0
 
LVL 9

Author Comment

by:Nick_72
ID: 9681712
Thanks guys. As the newbie I am, I first inserted

#define _WIN32_WINNT 0x0400

in the .cpp file, before any #include statements. That didn't work (and I still really don't know why, since it comes before the include stdAfx.h), but when I inserted the statement in stdAfx.h as you said (and I guess that was what you meant jkr) it worked perfectly :)

Thanks again, I'll split the points.

/Nick
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9681795
Dang.  I had just finished preparing a nice cream sauce... I would have missed that old Dodger cap though.
0
 
LVL 9

Author Comment

by:Nick_72
ID: 9682746
I was picturing a sombrero so I wasn't only happy for me when it compiled without errors :)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 181
Prevent this page from creating additional dialogs. 3 527
pre4 challenge 19 100
zeroMAx challenge 20 100
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question