Solved

C2039 compiling errors

Posted on 2006-10-19
4
434 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

624 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