Compiling libgadu on Windows

I want to use libgadu (instant messaging protocol library) in Visual Studio 2008. I downloaded libgadu http://toxygen.net/libgadu/files/libgadu-1.8.2.tar.gz and under cygwin I compiled it -. / configure, make, make install. The libgadu.h file that appeared in the include folder I copied to another folder marked in VS, including the files folder.

I wanted to compile the code from the documentation

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <libgadu.h>

using namespace std;

int main(void)
{
    char password[]= "haslo";
    struct gg_session *sesja;
    struct gg_login_params parametry;
    struct gg_event *zdarzenie;

    memset(&parametry, 0, sizeof(parametry));
    parametry.uin = 12345;
    parametry.password = password;
    parametry.async = 1;
    parametry.status = GG_STATUS_INVISIBLE;


    sesja = gg_login(&parametry);
    if (!sesja) {
        cout << "Can't connect" << endl;
       exit(1);
    }

    system("PAUSE");
}

      

I get two errors during compilation:

Error   1   error LNK2019: unresolved external symbol _gg_login referenced in function _main    1.obj
Error   2   fatal error LNK1120: 1 unresolved externals 

      

What should I do about it?

+1


source to share


3 answers


You need to find the compiled DLL and LIB file, or just the LIB file if it was compiled into a static library. The files will probably be named libgadu.dll and libgadu.lib.

After that, you can tell Visual Studio to link to the LIB file by choosing Project Properties and find Additional Dependencies in the linker settings.



Just add libgadu

additional dependencies to the list for all configurations.

+2


source


As Frank said, this usually means the library (.lib or .dll) is not linked. However, if a successful compiler does not create DLL or .lib files, the most likely case is that the build systems between Cygwin and VS are out of sync.

In particular, the file is not getting referenced in the VS project file. I feel like it is libgagdu.c since the gg_login function is defined in it.



Just add this file to your project and rebuild. If that works, check with the libgadu developers so they can fix it at their end.

+1


source


Strange, because on time. / configure, build in Cygwin, it doesn't create any DLL or .lib files.

0


source







All Articles