I want to use libgadu (library of instant messaging protocol) under Visual Studio 2008. I have downloaded libgadu http://toxygen.net/libgadu/files/libgadu-1.8.2.tar.gz and under cygwin I've compiled it - ./configure , make , make install. File libgadu.h which appeard in include folder I copied to another folder which is marked in VS as Including files directory.
I wanted to compile code from 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(¶metry, 0, sizeof(parametry));
parametry.uin = 12345;
parametry.password = password;
parametry.async = 1;
parametry.status = GG_STATUS_INVISIBLE;
sesja = gg_login(¶metry);
if (!sesja) {
cout << "Can't connect" << endl;
exit(1);
}
system("PAUSE");
}
During compiling i receive two errors:
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 with it?
You need to locate the compiled DLL and LIB file, or just LIB file if it was compiled into a static library. The files will probably be named libgadu.dll and libgadu.lib.
Once you have those, you can instruct Visual Studio to link with the LIB file by selecting Project Properties and locating the Additional Dependencies under the Linker settings.
Just add libgadu
to the additional dependencies list for All Configurations.