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

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.