• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1513
  • Last Modified:

compiling error and warning.

Need help with the following:

Error      2      error C2065: 'COINIT_MULTITHREADED' : undeclared identifier      C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\atlcom.h      147
Warning      1      warning C4005: '_WIN32_WINNT' : macro redefinition      c:\projects\unityextproperty\CPropSheetExtension.h      18
0
lapucca
Asked:
lapucca
  • 4
  • 4
1 Solution
 
lapuccaAuthor Commented:
Ok, got rid of the warning but I still need help with the error.
0
 
lapuccaAuthor Commented:
In atlcom.h the following code is generating the error:
#if ((_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM))
      else
      if (hr == RPC_E_CHANGED_MODE)
      {      
            *pApartmentType = COINIT_MULTITHREADED;
            return true;
      }
#endif

In the objbase.h, the definition for COINIT_MULTITHREADED is gryed.  What does that mean?  It doesn't seem to be commented out but it's causing problem.  It says only needed for NT4, which I don't need to support.  
/ COM initialization flags; passed to CoInitialize.
typedef enum tagCOINIT
{
  COINIT_APARTMENTTHREADED  = 0x2,      // Apartment model

#if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  // These constants are only valid on Windows NT 4.0
  COINIT_MULTITHREADED      = 0x0,      // OLE calls objects on any thread.
  COINIT_DISABLE_OLE1DDE    = 0x4,      // Don't use DDE for Ole1 support.
  COINIT_SPEED_OVER_MEMORY  = 0x8,      // Trade memory for speed.
#endif // DCOM
} COINIT;
0
 
NickGeorghiouCommented:
Maybe you have your compiler options set to single-threaded instead of multi-threaded?

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
NickGeorghiouCommented:
Not sure about VC8, I am still using VC7 but it will probably be the same or similar ->

1. Within ide right-click on your project and select properties
2. Expand the C++ folder and select Code Generation
3. Check the Runtime Library setting

You need to set this to Multi-threaded or Multi-threaded Debug depending on whether you are building a debug or release version.
0
 
lapuccaAuthor Commented:
It's set at multi-threading.

What if I comment out that section of code in atlcom.h.  Will that be OK?  Becuase that would get rid of the error.

#if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  // These constants are only valid on Windows NT 4.0
  COINIT_MULTITHREADED      = 0x0,      // OLE calls objects on any thread.
  COINIT_DISABLE_OLE1DDE    = 0x4,      // Don't use DDE for Ole1 support.
  COINIT_SPEED_OVER_MEMORY  = 0x8,      // Trade memory for speed.
#endif // DCOM
0
 
NickGeorghiouCommented:
No, I don't think you should comment out the code - that will be a workaround that might cause other issues. The problem is pointing to something else.

Have you tried defining _WIN32_DCOM in the project settings?
0
 
lapuccaAuthor Commented:
Nop.  How do I define _WIN32_DCOM in my project and where?  Thanks.
0
 
NickGeorghiouCommented:
Sorry, don't have VC in front of me at the moment but I think it should be something like:

1. Within ide right-click on your project and select properties
2. I think there is a Compile tab or folder.
3. You should be able to select Advanced Compile Options
4. And then I think there is a Custom Constants field in which you can add _WIN32_DCOM

Alternatively, you can just define it in your code somewhere eg.

#define _WIN32_DCOM


0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now