Problem updating to .net

A

Altman

We just recently got an MSDN subscription and obtained a copy of .Net. I am
trying to convert a VC++ 6.0 code to .net and when I try to build it I get
the following error
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(144): error C2065: 'COINIT_MULTITHREADED' :
undeclared identifier

I have limited experience with C++ and I cannot figure this out. The error
is in the header file made by microsoft. How can this be? This seems to be
the only error that I am getting though. Are there any other things in
converting that I should watch out for? Also, in order to run this program
on another machine do they need have the .Net Framework installed?
 
W

William DePalo [MVP VC++]

Altman said:
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(144): error C2065: 'COINIT_MULTITHREADED' :
undeclared identifier
OK.

I have limited experience with C++ and I cannot figure this out.

Here is a hint that you can use to solve a similar problem on your own the
next time. Highlight or double-click a "token" in your source. Click the
right mouse button and choose "Go to definition" from the context menu. I
haven't tried that but you should be taken here in <objbase.h>

#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

The first check makes sure you are running on an NT platform (NT/2K/XP/2K+3)
at least as recent as version 4.00. The second checks if the target as
distributed COM installed.

To fix the problem add this line

#define _WIN32_WINNT 0x0400

if you only intend to support NT kernels or

#define _WIN32_DCOM

if you presume DCOM has been installed.

Alternatively you can set the defines in your project settings of the C++
options.

Regards,
Will
 
A

Altman

Thanks for the reply but I am still having problems. First off I have
#define _WIN32_WINNT 0x0400 in my stdafx.h file and I noticed that has the
include for atlcom.h. Shouldn't this be enough? Anyway I did add the
#define to my objbase.h and I didn't get that error but I then get these
errors

PortMonitor error LNK2005: __fltused already defined in
atlmincrt.lib(atlinit.obj)
PortMonitor error LNK2005: _malloc already defined in
atlmincrt.lib(atlinit.obj)
PortMonitor error LNK2005: _free already defined in
atlmincrt.lib(atlinit.obj)
PortMonitor error LNK2005: _realloc already defined in
atlmincrt.lib(atlinit.obj)
PortMonitor warning LNK4222: exported symbol 'DllCanUnloadNow' should not be
assigned an ordinal
PortMonitor warning LNK4222: exported symbol 'DllGetClassObject' should not
be assigned an ordinal
PortMonitor warning LNK4222: exported symbol 'DllRegisterServer' should not
be assigned an ordinal
PortMonitor warning LNK4222: exported symbol 'DllUnregisterServer' should
not be assigned an ordinal
PortMonitor warning LNK4006: __fltused already defined in
atlmincrt.lib(atlinit.obj); second definition ignored
PortMonitor warning LNK4006: _malloc already defined in
atlmincrt.lib(atlinit.obj); second definition ignored
PortMonitor warning LNK4006: _free already defined in
atlmincrt.lib(atlinit.obj); second definition ignored
PortMonitor warning LNK4006: _realloc already defined in
atlmincrt.lib(atlinit.obj); second definition ignored
PortMonitor error LNK2001: unresolved external symbol ___xt_z
PortMonitor error LNK2001: unresolved external symbol ___xt_a
PortMonitor error LNK2001: unresolved external symbol ___xp_z
PortMonitor error LNK2001: unresolved external symbol ___xp_a
PortMonitor fatal error LNK1120: 4 unresolved externals

And this I really have no clue on. I'm sorry, I feel like an idiot but I am
pretty fresh out of college and the main language they taught there was
Java, and my other languages are like VB, and VFP, and JavaScript so it is a
little different, then I get out in the workplace and get a job where I am
the only programmer trying to update code that was written 5 years ago and I
have no one that has experience in C++ to ask. I can understand the basic
syntax of the language but its all this extra stuff that throws me off.
 
V

valkavales

Try to change compiler options RunTimeLibrary -> Single-Threaded
Multi-Threade


-
valkavale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top