Solved

compiling error and warning.

Posted on 2006-10-20
8
1,458 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
 
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now