Solved

C2039 compiling errors

Posted on 2006-10-19
4
433 Views
Last Modified: 2008-02-01
I've created a empty project and added a ATL class to it.  I then copy the ATL cpp files and the header file and add it to my C++ COM project.

I'm getting a lot of compiling error C2039 like those listed below.  I double cliked to see the definition of those structure and the members are part of the structure's defintion.  I can also type . or -> and the intellisense would bring up the members including those complained in the errors as valid members to select from.  It's very odd.  How can I correct this?  Thanks.

Error      55      error C2039: 'aObjects' : is not a member of 'DSOBJECTNAMES'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      54
Error      28      error C2039: 'cfFormat' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      21
Error      45      error C2039: 'cfFormat' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      42
Error      31      error C2039: 'dwAspect' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      23
Error      48      error C2039: 'dwAspect' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      44
Error      38      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      29
Error      42      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      35
Error      53      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      50
Error      59      error C2039: 'hGlobal' : is not a member of 'tagSTGMEDIUM'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      58
Error      33      error C2039: 'lindex' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      24
Error      49      error C2039: 'lindex' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      45
Error      30      error C2039: 'ptd' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      22
Error      47      error C2039: 'ptd' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      43
Error      34      error C2039: 'tymed' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      25
Error      50      error C2039: 'tymed' : is not a member of 'tagFORMATETC'      c:\Projects\UnityExtProperty\AdPropShlExt.cpp      46


--
Thanks.
0
Comment
Question by:lapucca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 17770752
Did you forget to

#include <Dsclient.h>
#include <objidl.h>

?
0
 

Author Comment

by:lapucca
ID: 17770778
I added "#include <objidl.h>" but I'm still getting those errors.  Here are all my include files and their orders.  Thanks.

#include <Objbase.h>
#include <asn1.h>
#include <activeds.h>
#include <aclapi.h>
#include <atlbase.h>
#include <atlconv.h>
#include "Adsprop.h"
#include <shlobj.h>
#include "Dsclient.h"
#include <objidl.h>
#include "blob.h"
#include "debug.h"
#include "globals.h"
#include <comdef.h>
#include <commctrl.h>
#include <comutil.h>
#include <crtdbg.h>
#include <Iads.h>
#include <mmc.h>
#include <string.h>
#include <tchar.h>
#include <vector>
#include "resource.h"
#include <string>
#include <windows.h>
#include "winldap.h"
#include "Sddl.h."
#include <stdio.h>
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17770993
Hm, could you post the code where the errors occur?

BTW, put

#include <windows.h>

at the top of the include list.
0
 

Author Comment

by:lapucca
ID: 17771017
I moved the windows.h to the top and the errors are still there.

I'm still working on the code that you pointed me to a couple of days ago, http://windowssdk.msdn.microsoft.com/en-us/library/ms676867(VS.80).aspx.  It didn't work when I add those codes to my existing C++ COM project that creates extended property page.  I now am trying to put most of those code into an ATL class and I added that to my C++ COM Project as a new class but I'm going through new compilation errors.  Below are some of the code where the errors are from.  As I mentioned earlier, it's strange that the intelliesense shows it's a valid member and so does the definition of the struct.

Here is the code for the 1st error message for aObjects:

HWND CreateADsNotificationObject(IDataObject *pDataObject)
{
    STGMEDIUM   stm;
    FORMATETC   fe;
    HRESULT     hr;
    HWND        hwndNotifyObject = NULL;

    /*
    The "DsAdminMultiSelectClipFormat" clipboard format is supported by the
    data object if the Active Directory Users and Computers snap-in supports
    multi-selection property sheets.
    */
    fe.cfFormat = RegisterClipboardFormat(TEXT("DsAdminMultiSelectClipFormat"));
    fe.ptd = NULL;
    fe.dwAspect = DVASPECT_CONTENT;
    fe.lindex = -1;
    fe.tymed = TYMED_HGLOBAL;
    hr = pDataObject->GetData(&fe, &stm);
    if (SUCCEEDED(hr))
    {
        PWSTR pwzUniqueID = (LPWSTR)GlobalLock(stm.hGlobal);

        if (pwzUniqueID)
        {
            hr = ADsPropCreateNotifyObj(pDataObject, pwzUniqueID, &hwndNotifyObject);

            GlobalUnlock(stm.hGlobal);
        }
           
        ReleaseStgMedium(&stm);
    }
    else
    {
        fe.cfFormat = RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
        fe.ptd = NULL;
        fe.dwAspect = DVASPECT_CONTENT;
        fe.lindex = -1;
        fe.tymed = TYMED_HGLOBAL;
        hr = pDataObject->GetData(&fe, &stm);
        if(SUCCEEDED(hr))
        {
            LPDSOBJECTNAMES pdson = (LPDSOBJECTNAMES)GlobalLock(stm.hGlobal);

            if(pdson)
            {
                LPWSTR  pwszName = (LPWSTR)((LPBYTE)pdson + pdson->aObjects[0].offsetName);
               
                hr = ADsPropCreateNotifyObj(pDataObject, pwszName, &hwndNotifyObject);

                GlobalUnlock(stm.hGlobal);
            }
           
            ReleaseStgMedium(&stm);
        }
    }

    return hwndNotifyObject;

}
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

729 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