Linker issue with ext. library in Visual Studio [SOLVED]

I’m working on the Windows port of a plug-in, and there’s some issue with it not finding an external library it needs during the linking phase of the build. I’m getting hundreds of “unresolved external symbol” errors from the linker. Odd thing is, in the error messages, it claims the library filepath is:
Z:\git repos\MyPlugin\Builds\VisualStudio2017\cryptlib.obj

However, in Projucer, I have specified Extra library search paths to be:
C:\Users\me\Desktop\cryptopp\x64\cryptlib\Debug\

So Visual Studio is looking in a MyPlugin\Builds subdirectory for a library file that exists on a completely different drive! Does this indicate that it’s not finding anything in that search path, and falling back on MyPlugin\Builds as a default search path?

A bit more info, in case anyone can help troubleshoot this…

In Visual Studio, I tried checking the “Configuration Properties” to see if the library search paths were correctly translating from Projucer to there. Here are the two places I was looking, but the values shown aren’t very enlightening:

  1. VC++ Directories→ Library Directories = $(LibraryPath);<different options>
  2. Linker→ General→ Additional Library Directories = <different options>

And under Configuration PropertiesLinkerInputAdditional Dependencies, I do see cryptlib listed there.

When you see “different options” you need to select a specific configuration and/or platform to see what options are set for that configuration/platform combination.

Ah, right you are… I thought that the dropdown menu to pick the specific configuration had been ghosted out before, but in any case now it’s working.

OK so now I see that my library path C:\Users\me\Desktop\cryptopp\x64\cryptlib\Debug\ is indeed showing correctly in Visual Studio, in both the VC++ Directories and Linker→ General fields.

Any idea then why Visual Studio’s error report would be referencing (the nonexistent) Z:\git repos\MyPlugin\Builds\VisualStudio2017\cryptlib.obj then?

Arg finally figured it out - I had built cryptopp as a static library, and despite providing the search path in Projucer (under Extra library search paths) where cryptlib.lib could be found, the linker still was not utilizing it.

Adding the following line to my source code made it work:

#pragma comment(lib, "cryptlib.lib")

I put this in the header of the class where I’m using the crypto stuff, although I’m not sure if that location matters.


EDIT to add:

It turns out that, instead of using that #pragma directive, it works if in Projucer the External libraries to link field is set to:

cryptlib.lib

Including the library file’s extension in the name goes against virtually all of the advice found on this forum (save this helpful post)… that is, the advice given is to just include the library name i.e. “cryptlib” in that field.

It may even go against the Projucer Manual, which states that the External libraries to link field is for:

Additional libraries to link (one per line). You should not add any platform specific decoration to these names.

I say “it may go against,” as I’m not sure if a file extension qualifies as a “platform specific decoration” or not.

Anyways… it’s all a bit frustrating, as clearer documentation of how to handle static libraries might have saved me days of hair pulling on this issue.