# Importing static lib that uses COM

This topic is 5473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm importing the static lib for LZMA into another project (this is all related to compressing resources for a game). The problem is the author's code uses COM, which I don't know. This is the error I get when I try to import the code in the static lib:
Linking...
LZMAWrapperDebug.lib(LZMAEncoder.obj) : error LNK2001: unresolved external symbol _IID_IMatchFinderSetCallback
LZMAWrapperDebug.lib(LZMAEncoder.obj) : error LNK2001: unresolved external symbol _IID_ICompressWriteCoderProperties
LZMAWrapperDebug.lib(LZMAEncoder.obj) : error LNK2001: unresolved external symbol _IID_ICompressSetCoderProperties
LZMAWrapperDebug.lib(LZMAEncoder.obj) : error LNK2001: unresolved external symbol _IID_ICompressSetOutStream

This is the line of code that I added, which is the function that I call from the second project:
int Zip(char *inputPath, char *outputPath, int properties)
{
NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
CMyComPtr<ICompressCoder> encoder = encoderSpec;

return 0;
}

This is the place where he defines those functions:
 STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
const PROPVARIANT *properties, UInt32 numProperties);

etc. This is the place where he implements those functions:
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
const PROPVARIANT *properties, UInt32 numProperties)

etc. This is some kind of GUID thing:
// {23170F69-40C1-278A-0000-000200200000}
DEFINE_GUID(IID_ICompressSetCoderProperties,
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00);
MIDL_INTERFACE("23170F69-40C1-278A-0000-000200200000")
ICompressSetCoderProperties: public IUnknown
{
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
const PROPVARIANT *properties, UInt32 numProperties) PURE;
};

What do I need to do to get it to link properly?

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 13
• 14
• 45