LNK2028 and LNK2019 errors with MQSeries 6 in unmanaged c++ code in VS C++ 2005

I have 2 unmanaged C++ functions that are attempting to put and get from a websphere 6 mq local queue.    Everything in my program links ok except for the functions related to MQ.
Two examples of errors are:
error LNK2028: unresolved token (0A0003A8) "public: virtual __thiscall ImqMgr::~ImqMgr(void)" (??1ImqMgr@@$$FUAE@XZ) referenced in function "public: void __thiscall ImqMgr::`vbase destructor'(void)" (??_DImqMgr@@$$FQAEXXZ)      FEPAdapterMain.obj      
error LNK2019: unresolved external symbol "public: virtual __thiscall ImqErr::~ImqErr(void)" (??1ImqErr@@$$FUAE@XZ) referenced in function "public: void __thiscall ImqMgr::`vbase destructor'(void)" (??_DImqMgr@@$$FQAEXXZ)      FEPAdapterMain.obj      

I have spent two days going through every forum imaginable...and nothing seems to resolve the issue.
I have not posted to many forums..so please let me know what additional information you need to help me with this problem.  I would really appreciate the help.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not familiar with websphere; but I'll take a guess. Do you have an interface with virtual destructors ImqMgr::~ImqMgr(), but in some derived class (possibly multiple levels down), maybe you did not implement a virtual destructor for that derived class?
fraeliz8Author Commented:
Thanks so much for answering phoffric.... here is the latest based on your comment and some others I received from other internal technical folks:

Since i have what should be all unmanaged functions: in my Visual C++ project (meaning the following wraps around both .cpp modules:)

#ifdef _MANAGED
#pragma managed(push, off)

#ifdef _MANAGED
#pragma managed(pop)

1. I have changed    /clr  (Common Language Runtime support)   to No Common Language Runtime Support
2. I have changed Runtime Library from /MT to /MDd  
3.Added what I think are virtual destructors to header file (class) and .cpp file.
(this last one seemed to have no effect. Did this after the LNK2028 had already gone away)

THe LNK 2028 errors have gone away and remain with LNK2019 (31 errors)   smilar to the following pair:
* Error 23 error LNK2019: unresolved external symbol "public: __thiscall ImqMgr::ImqMgr(void)" (??0ImqMgr@@QAE@XZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall FEPMain::GetQueue(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?GetQueue@FEPMain@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V23@0@Z)      FEPAdapterMain.obj      

* Error 26 error LNK2019: unresolved external symbol "public: virtual __thiscall ImqMgr::~ImqMgr(void)" (??1ImqMgr@@UAE@XZ) referenced in function "public: void __thiscall ImqMgr::`vbase destructor'(void)" (??_DImqMgr@@QAEXXZ)      FEPAdapterMain.obj      

and  the final error mentions 26 unresolved externals:
Error      32      fatal error LNK1120: 26 unresolved externals      C:\Facets\TRG_461\Applications\Meta\FEP\FEPAdapter\Debug\FEPAdapterWrapperCPP2.dll      
similar to:

This used to be  27 unresolved externals..and quite frankly I'm not sure what caused the decrease by 1 : )

fraeliz8Author Commented:
One more thing.  When i comment out all code related to websphere MQ... the project builds wih  out error.  I just left in the shell of the functions and commented out all code except for one declare and a return statement.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Is this correct?
LNK2019: In your FEPAdapterMain.cpp file  is FEPMain::GetQueue() method, which has a ImqMgr object defined (which invokes the ImqMgr constructor). In FEPAdapterMain.cpp is an #include statement in which the ImqMgr constructor is declared.

If correct, then where is the ImqMgr constructor defined, in source code that you compile and link in?
>> LNK2019: unresolved external symbol  ImqMgr::~ImqMgr referenced in ... FEPAdapterMain.obj
>> Added ... virtual destructors to header file (class) and .cpp file
Is it true that class(es) in FEPAdapterMain is(are) derived from ImqMgr? If so, you added virtual destructor(s) in them, right? You can post your code (or snippets) if you wish.


Some generic advice:

In reviewing these errors online, I see that some recommendations is to start fresh. Sometimes this advice is necessary because VS gets hosed (when even clean does not work, and even after you manually clean out what clean fails to remove as I have seen this myself).

Even if VS is not hosed (as it has been for me on a few occasions), a fresh start can help.
Have you tried creating a new workspace and project with just the most basic main() program you can come up with (preferably, one right out of the manual - a MQ Hello World)? It should include only a minimal amount of code related to websphere MQ right out of the documentation. Then build upon this "working build" one step at a time adding the problematic function/method calls. This may help identify the single step that causes a good build to yield the errors you are seeing.


I see from your recent comment that the problem lies in dll - not my bailiwick. If you make no further progress, let me know, and I'll see if I can find some additional support for you.


Some additional references for: websphere MQ LNK2019 error (you may have seen these as you have already taken some of the advice).


Looks like the code for ImqMgr is not linked in.
From the link above:    "try adding mqm.lib to the link"
Did you verify that mqm.lib is in your link?
fraeliz8Author Commented:
I really do appreciate all the assistance......really do.   Not sure how I provide credit...i see you guys get points for things solved etc....and you did partially help me.

Well..... went to the IBM maintenance contract....and it seems you guys were on the right path... something was not linked in...turned out to be that i needed
Added two of the below to additional dependencies in the link.... and it built.  I guess just supplying the path containing these was not enough.

imqb23vn.lib.... this is base
(imqb13vn.lib is needed whether just running the client (like our meta frames with the environment Variable, or actually on the box with the mq server.

Then one of the following.
imqs23vn.lib....  use this one for server

imqc23vn.lib....  use this one for client

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I think your last post which provided the complete solution should be the accepted solution since that information will provide a good source of information for the PAQ. Then assign points to other posts which also assist the question which, in your opinion, will also help the PAQ.
>> and you did partially help me
I see you gave us 0 points. You are able to provide points for partial help. Do you know how to do this?
Recommend splitting points since author said "you did partially help me"; and the supplied answers may be useful for the PAQ.
I don't think I helped at all so if you are awarding any points, give them to phorffric.
Recommend points for http:#33434958 and http:#33435632
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.