Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hello. My problem is i get identifier is undefined problem despite defining it. Here's the context of the situation:
 
...
typedef WINSETUPAPI BOOL (*SetupDiEnumDeviceInterfacesUMPTR)(HDEVINFO, PSP_DEVINFO_DATA, LPGUID, DWORD, PSP_DEVICE_INTERFACE_DATA);
...
class DLL
{ 
  public:
         DLL()
         {
             ...
             SetupDiEnumDeviceInterfacesUMPTR _SetupDiEnumDeviceInterfacesUMPTR;
             ...
             HINSTANCE hSetUpApi = LoadLibrary("setupapi.dll");
             ...
             _SetupDiEnumDeviceInterfacesUMPTR = (SetupDiEnumDeviceInterfacesUMPTR)GetProcAddress(hSetUpApi, "SetupDiEnumDeviceInterfaces");
             ...
         }
         ...
         if(_SetupDiEnumDeviceInterfacesUMPTR(DeviceInfoTable, NULL, &InterfaceClassGuid, InterfaceIndex, InterfaceDataStructure)) // _SetupDiEnumDeviceInterfacesUMPTR undefined
         ...
}
 
Thanks for help.
Posted 7-Feb-13 22:31pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

_SetupDiEnumDeviceInterfacesUMPTR is out of scope by the time you get to the if statement - it's defined inside the braces of DLL()
 
Explanation here ...
http://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm[^]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 505
1 OriginalGriff 258
2 ChintanShukla 195
3 Bhavik_Patel 170
4 Richard Deeming 165
0 Sergey Alexandrovich Kryukov 8,688
1 OriginalGriff 7,237
2 CPallini 2,598
3 Richard MacCutchan 2,080
4 Abhinav S 1,888


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100