Solved

Comipling Code from VC 4.2 to VC 6.0

Posted on 2000-05-08
5
571 Views
Last Modified: 2010-05-18
I am compiling code written for VC++ 4.2 in VC++ 6.0.  I am getting the LINK errors:
Linking...
nafxcw.lib(cmdtarg.obj) : error LNK2001: unresolved external symbol _IID_IDispatch
nafxcw.lib(filecore.obj) : error LNK2001: unresolved external symbol _IID_IClassFactory
nafxcw.lib(filecore.obj) : error LNK2001: unresolved external symbol _IID_IPersistFile
.\Release/program.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

dpprint.exe - 4 error(s), 0 warning(s)

Any ideas on what I have to do to get this to work?  Thanks.
0
Comment
Question by:paulca
[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
  • 3
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 2789029
Simply add

#pragma comment( lib, "uuid.lib")

to your code. This import library is needed to resolve the IIDs that are missing.
0
 

Author Comment

by:paulca
ID: 2789128
I added this line to my C++ file before all the #include and tried to compile it but I got the same errors again.
0
 
LVL 86

Expert Comment

by:jkr
ID: 2789575
Aahh, now I think I see your problem...

Make sure that the '#include' directives look like this:

#ifndef INITGUID
      #pragma data_seg(".text")
      #define INITGUID
      #include <objbase.h>
      #include <initguid.h>
      #include <shlguid.h>
      #pragma data_seg()
#undef INITGUID
#endif

#pragma comment( lib, "uuid.lib")

0
 

Author Comment

by:paulca
ID: 2789656
I placed this code into my C++ program but now I am getting the error:

fatal error C1020: unexpected #endif

I went down through the code to make sure that no #if's were missing their #endif.

I can't see why it is giving me this error.
0
 
LVL 86

Expert Comment

by:jkr
ID: 2789887
Hmm, that's strange (copyied the above from a working project) - try to remove the #ifdef INITGUID/#endif pair...
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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

623 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