I am using MS Visual C++ to do a "quick" little project to create a tiny dll that I need. I hope this is the correct forum for this question.

I have a fairly simple project that compiles with no errors but, when I try to build it, I am getting some linking errors. The errors are cause by my use of msi.h, msiquery.h, and ShFolder.h.

If I understand linking correctly, the linker is trying to match the declaration of certain functions that are declared in the header files I mentioned above with their implementation in some other file. So, it seems that I should find the .lib files that implement the functions I am using, and make sure the compiler can find those files, right?

I am using one function from msiquery.h, and that is MsiSetTargetPath. I am using one function from ShFolder.h, and that is SHGetFolderPath. My includes look like this:
#include "msi.h" //not sure this is necesarry
#include "MsiQuery.h"
#include "ShFolder.h"

The linker errors I am getting are as follows:
FindPublicDocsDir.obj : error LNK2001: unresolved external symbol _MsiSetTargetPathA@12
FindPublicDocsDir.obj : error LNK2001: unresolved external symbol __imp__SHGetFolderPathA@20

I cannot find a msquery.lib or shfolder.lib on my machine. I have found a shfolder.dll file but, I am not sure if I can reference that.

Can someone give me some advice on what to do?

Thanks very much.

Disregard this post!

I think I solved it by going to Project >> Settings >> Link and adding msi.lib to the object/library modules.

Then I downloaded the latest MS SDK, and it had ShFolder.lib in it. I copied that file to the appropriate location, and entered that in the object/library modules area as well.

BOOM. It built. Sorry for the distraction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.