Solved

Comipling Code from VC 4.2 to VC 6.0

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

708 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

16 Experts available now in Live!

Get 1:1 Help Now