Solved

Comipling Code from VC 4.2 to VC 6.0

Posted on 2000-05-08
5
522 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

914 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now