Search code examples
visual-studiogpgme

link to gpgme library in Visual Studio


I found this old post:

Using the gpgme library from .NET?

but it can't help me to link my C++ project (Visual Studio) to libgpgme-11.dll.

I am using Windows 10 platform, and have done the followings to try to set it up:

Properties->Linker->Input: libgpgme-11.dll Properties->Linker->Additional Library Directories: Gpg4win\lib and Gpg4win\bin_64 Properties->C/C++ General->Additional Include Directories: Gpg4win\include

When I compiled the project, I got an Link error LNK1107 invalid or corrupt file: can not read at 0x368.

It seems to me that the libgpgme-11.dll is not the correct one to link against. Yet, I don't find any gpgme lib files under the root Gpg4win folder.

Any recommendation ?

Eric


Solution

  • There are three things to do in setting gpgme in Visual Studio:

    1. Add "Gpg4win\include" to the "Additional Include Directories" property
    2. Add "Gpg4win\bin and Gpg4win\lib" to the "Additional Library Directories" property
    3. Add "libgpgme.imp" to the "Additional Dependencies" property

    The Additional Library Directories and Additional Dependencies properties are under Linker's General and Input tabs. The Additional Include Directories property is under C/C++ General tab.

    Hope this saves someone else's time.