[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

VC++2005 newbie question

All I did was create a new project with the MFC project wizard -- SDI, database support in headers, split window enabled, windows sockets enabled -- then click "Start Debugging".  I get 13 errors from winbase.h, starting with "error C2065: 'PFLS_CALLBACK_FUNCTION' : undeclared identifier"

Any ideas?  Thanks in advance.
0
brightak
Asked:
brightak
  • 5
  • 2
  • 2
  • +1
1 Solution
 
jkrCommented:
That one is declared in WinNT.h as

typedef
VOID
(NTAPI *PFLS_CALLBACK_FUNCTION) (
    IN PVOID lpFlsData
    );
0
 
brightakAuthor Commented:
I did a search on "PFLS" and it's not in my project.  If this is called directly, it's from Microsoft's code and not in anything I should be changing.
0
 
brightakAuthor Commented:
What follows is the Output Window section of my BuildLog.htm
Compiling...
stdafx.cpp
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(4850) : error C2065: 'PFLS_CALLBACK_FUNCTION' : undeclared identifier
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(4851) : error C2146: syntax error : missing ')' before identifier 'lpCallback'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(4851) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(4851) : error C2491: 'FlsAlloc' : definition of dllimport data not allowed
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(4851) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8716) : error C2061: syntax error : identifier 'WELL_KNOWN_SID_TYPE'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8723) : error C2065: 'WELL_KNOWN_SID_TYPE' : undeclared identifier
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8723) : error C2146: syntax error : missing ')' before identifier 'WellKnownSidType'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8723) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8723) : error C2491: 'CreateWellKnownSid' : definition of dllimport data not allowed
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(8727) : error C2059: syntax error : ')'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(11245) : error C2065: 'PSYSTEM_LOGICAL_PROCESSOR_INFORMATION' : undeclared identifier
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(11245) : error C2146: syntax error : missing ')' before identifier 'Buffer'
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(11245) : warning C4229: anachronism used : modifiers on data are ignored
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(11245) : error C2491: 'GetLogicalProcessorInformation' : definition of dllimport data not allowed
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winbase.h(11247) : error C2059: syntax error : ')'
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jkrCommented:
There is something really going wrong with your installation. What is the size of your WinNT.h?
0
 
itsmeandnobodyelseCommented:
>>>> That one is declared in WinNT.h as

actually the errors are in WinBase.h and *not* in WinNt.h . Winbase.h most likely was included via #include <windows.h>-

>>>> Compiling... stdafx.cpp
The stdafx.cpp is the source to create the 'precompiled header file'. It should have only one single statement:

#include "stdafx.h"

and nothing else. In the C++ - Precompiled Header  properties it should have the option 'Create PCH via stdafx.h' switched on and it should be the only cpp where it was switched on.

>>>> error C2065: 'PFLS_CALLBACK_FUNCTION' :

C2065 means that the compiler didn't recognize that 'PFLS_CALLBACK_FUNCTION' was typedef'd as a new type of a function pointer, means the 'PFLS_CALLBACK_FUNCTION' could be any arbitrary name here.  It expects a *already defined* type instead of 'PFLS_CALLBACK_FUNCTION' here what means that parts before that name were not properly recognized. Here we have VOID and NTAPI  (if you have the same definition as jkr and me). But both were used a hundred of times in definitions above, so actually it could not fail here if tthese macros were unknown (the definitions were in winnt.h and windef.h) but you would have get a cillion errors before.

errors like that occur for various reasons:

1. you have mixed-up include folders. e. g. from VC6 and VC8 which both are in the project include folders or in the common include folders.

2. You included a header *above* windows.h but that header wasn't properly nested, e. g. there is a missing #endif or a class declaration wasn't closed with ;

3. You included <windows.h> above "stdafx.h" , so it was ignored by the compiler but not by the precompiler. Or you included <windows.h> below "stdafx.h" though it already was included in stdafx.h. Then the compiler errors come because macro protection like

#ifndef _WINBASE_
#define _WINBASE_

at the very top of winbase.h that should prevent from including winbase.h twice would not work cause macros were not evaluated when dealing with precompiled headers.

What to do?

- Check the PCH settings of stdafx.cpp
- Check that it included "stdafx.h" only and nothing else.
- Check stdafx.h whether it was updated to include more headers.
- If yes, put these includes below the old ones and not above.
- Check that each header compiles and is correctly nested.
- For bigger headers you can do that by renaming the header to a .cpp
  or a .c  (for pure C headers) and compiling it. (not using PCH).
- Doing so, you additionally will find out whether the header includes
  all depending headers and have appropriate forward declarations.

if stdafx.cpp still doesn't compile, you could add a new source to your project which contains nothing but a

#include <windows.h>

and where you switched off PCH. If that doesn't compile with the same errors your installation was corrupt. If it compiles there is something wrong with your stdafx.h.

Regards, Alex
0
 
brightakAuthor Commented:
The PCH settings of stdafx.cpp look fine.  I tried to repair my install from the disk, but it didn't help.  What follows is my stdafx.h file.  If it was updated to include more headers, I can't see where.

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently

#pragma once

#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif

#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
#endif

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER                        // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501            // Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_WINNT            // Allow use of features specific to Windows XP or later.                  
#define _WIN32_WINNT 0x0501      // Change this to the appropriate value to target other versions of Windows.
#endif                                    

#ifndef _WIN32_WINDOWS            // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE                  // Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600      // Change this to the appropriate value to target other versions of IE.
#endif

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit

// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS

#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions


#include <afxdisp.h>        // MFC Automation classes


 // Here, minimal DB support is requested.  No view is chosen.

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>            // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>                  // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT


#include <afxsock.h>            // MFC socket extensions



#include <atlbase.h>
#include <afxoledb.h>
#include <atlplus.h>




#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif


Thanks again for your help.
0
 
brightakAuthor Commented:
Someone told me to move my SDK folder to the top of my include folders, and it worked.  It looks like I can't fairly give the points to either of you -- even though I appreciate your help.

Thanx
0
 
itsmeandnobodyelseCommented:
>>>> to move my SDK folder to the top of my include folders
that isn't a solution but a workaround. If that worked it means that other include folders contain the same header files than the SDK folders. Visual Studio may have taken them from 'include' environment variable at installation time. You should spot these folders in both the list of the include folders and the list of library folders (where most likely a similar problem exists). I assume you used another C/C++ compiler before VC where the environment variables 'include' and 'lib' were set.

>>>> PAQ with refund
No problem with that.

Regards, Alex
0
 
brightakAuthor Commented:
Alex,

Thanks for understanding.  Obviously, I'll be using your help in the (very near) future, so you won't lose any business.

In case you were wondering, I got my answer from MSDN forum "Visual C++->General"
0
 
Vee_ModCommented:
Closed, 250 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now