Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Problem updating to .net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Altman - 14 Jul 2004 14:52 GMT
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?
William DePalo [MVP VC++] - 14 Jul 2004 19:25 GMT
> 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
Altman - 14 Jul 2004 21:18 GMT
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.

>> C:\Program Files\Microsoft Visual Studio .NET
>> 2003\Vc7\atlmfc\include\atlcom.h(144): error C2065:
[quoted text clipped - 38 lines]
> Regards,
> Will
valkavales - 17 Mar 2005 12:03 GMT
Try to change compiler options RunTimeLibrary -> Single-Threaded
Multi-Threade

-
valkavale


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.