Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,907 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,207 people online right now. Registration is fast and FREE... Join Now!




VC++ 6.0 error LNK2001: unresolved external symbol

 
Reply to this topicStart new topic

VC++ 6.0 error LNK2001: unresolved external symbol, error LNK2001: unresolved external symbol _IID_IObjectConstructString

chaucer
8 Jan, 2008 - 01:05 PM
Post #1

New D.I.C Head
*

Joined: 8 Jan, 2008
Posts: 2

I am getting the following error when compiling a vendor supplied project:
CommsWorker.obj : error LNK2001: unresolved external symbol _IID_IObjectConstructString.

The vendor is no longer supporting this application, and we are trying to compile for an upgrade.

The problem is occurring in code that is using an interface. I'm hoping this is just a project set-up issue. Any help will be greatly appreciated!
CODE

//IObjectConstruct implementation
STDMETHODIMP CCommsWorker::Construct(IDispatch * pCtorObj)
{
   //    construct_string method is called by COM+
   //    if so configured in Component Services.
   //    Component Properties, Activation tab, Object
   //   constructor settings.
   HRESULT hr;
   CComPtr<IObjectConstructString> object_construct_string=NULL;
   BSTR construct_string=NULL;

   USES_CONVERSION;
  
   m_strConfigFileName = "";
   if (pCtorObj==NULL) return S_OK;

   try
   {
      // first get the IObjectConstructString interface from the
      // constructor object
      // THE CODE BELOW CAUSES THE COMPILE ERROR
      hr = pCtorObj->QueryInterface(IID_IObjectConstructString,
         reinterpret_cast<void**>(&object_construct_string) );
      if (!SUCCEEDED(hr) || object_construct_string==NULL) return S_OK;
        
      // Get the constructor string
      hr = object_construct_string->get_ConstructString(&construct_string);      
      if (!SUCCEEDED(hr)) return S_OK;

      // copy the string -- memory allocated by OLE2CA will
      // be automatically released when the method ends.
      m_strConfigFileName = (construct_string == NULL ? "" : OLE2CA(construct_string));
      
      // free the string we got from IObjectConstructString
      SysFreeString(construct_string);
   }
   catch(...)
   {
      // ignore any exceptions...
   }
   return S_OK;
}

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: VC++ 6.0 Error LNK2001: Unresolved External Symbol
8 Jan, 2008 - 03:01 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Well the error means that it simply can't find, and thus doesn't know what IID_IObjectConstructString even is, where you are using it. Look for the definition of this object and see if it is in a scope where this part of the program knows what it is or not. If it can't see what this object means, then it is going to throw this error. Also double check spelling and case to make sure it exactly matches its declaration.

smile.gif

This post has been edited by Martyr2: 8 Jan, 2008 - 03:02 PM
User is offlineProfile CardPM
+Quote Post

chaucer
RE: VC++ 6.0 Error LNK2001: Unresolved External Symbol
15 Feb, 2008 - 07:03 AM
Post #3

New D.I.C Head
*

Joined: 8 Jan, 2008
Posts: 2

I was able to compile by downloading and installing Microsoft Platform SDK. Becuase I'm using VC++ 6.0, I could not use the most current version. I had to go back to the February 2003 Update (version 5.2.3790.0).
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 01:27PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month