Solved

Comipling Code from VC 4.2 to VC 6.0

Posted on 2000-05-08
5
544 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

856 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