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
Solved

compiling error and warning.

Posted on 2006-10-20
8
1,466 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
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.

840 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