error C2146: syntax error : missing ';' before identifier 'IADs
Gives the Above error messages when I try to complile the below code..
#include "stdafx.h"
#include <activeds.h>
#include <stdio.h>
#include <activeds.h>
#include<Iads.h>
#include<Atlbase.h>
#include<objbase.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);
}
hr = pSys->get_ComputerName(&bstr);
if (SUCCEEDED(hr)) {
printf("Computer: %S/n", bstr);
SysFreeString(bstr);
}
hr = pSys->get_DomainDNSName(&bstr);
if (SUCCEEDED(hr)) {
printf("Domain: %S/n", bstr);
SysFreeString(bstr);
}
hr = pSys->get_PDCRoleOwner(&bstr);
if (SUCCEEDED(hr)) {
printf("PDC Role owner: %S/n", bstr);
SysFreeString(bstr);
}
if(pSys) {
pSys->Release();
}
CoUninitialize();
return 0;
}
Krishnaa
March 5th, 2007, 04:39 AM
You need to define target windows version, take a look at this,
Using Windows headers (http://msdn2.microsoft.com/en-us/aa383745.aspx)
vijay.yande
July 8th, 2008, 03:27 AM
Remove #define WIN32_LEAN_AND_MEAN from stdafx.h file.