We help IT Professionals succeed at work.
Get Started

CLSIDs not defined using ADSI in VC++.Net 2003

Jim Culpepper
on
1,117 Views
Last Modified: 2012-05-05
I have installed the MS Platform SDK (R2) on my workstation and am using C++ in VS2003.  In my first attempt at writing code to access Active Directory, I find that none of the CLSIDs are defined.  For example, when I compile the following example from Microsoft:

#include <activeds.h>
#include <stdio.h>
int main()
{
    HRESULT hr;
    hr = CoInitialize(NULL);
    IADsADSystemInfo      *pSys;
    hr = CoCreateInstance(CLSID_ADSystemInfo,
          NULL,
         CLSCTX_INPROC_SERVER,
         IID_IADsADSystemInfo,
        (void**)&pSys);
    BSTR bstr;
    hr = pSys->get_UserName(&bstr);
    if (SUCCEEDED(hr))
    {
      printf("User: %S\n", bstr);
      SysFreeString(bstr);
    }
    if(pSys)
    {
      pSys->Release();
    }
    CoUninitialize();
    return 0;
}

I receive Link errors that both CLSID_ADSystemInfo and IID_IADsADSystemInfo are undefined.  

I have made sure that the appropriate subfolders to "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2" are referenced in the VC++ Directories under Tools/Options.

What have I not done when installing the SDK?  Or, can you tell me where these CLSIDs are defined?
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE