Solved

compiling error and warning.

Posted on 2006-10-20
8
1,469 Views
Last Modified: 2012-06-27
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
Comment
Question by:lapucca
  • 4
  • 4
8 Comments
 

Author Comment

by:lapucca
ID: 17777606
Ok, got rid of the warning but I still need help with the error.
0
 

Author Comment

by:lapucca
ID: 17777632
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
 
LVL 5

Expert Comment

by:NickGeorghiou
ID: 17778334
Maybe you have your compiler options set to single-threaded instead of multi-threaded?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:NickGeorghiou
ID: 17778533
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
 

Author Comment

by:lapucca
ID: 17790216
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
 
LVL 5

Expert Comment

by:NickGeorghiou
ID: 17792691
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
 

Author Comment

by:lapucca
ID: 17793014
Nop.  How do I define _WIN32_DCOM in my project and where?  Thanks.
0
 
LVL 5

Accepted Solution

by:
NickGeorghiou earned 500 total points
ID: 17793114
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

713 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