?
Solved

compiling error and warning.

Posted on 2006-10-20
8
Medium Priority
?
1,482 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
[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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 clear a vector as well as how to detect empty vectors in C++.

777 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