Gabriel kotev
Gabriel kotev

Reputation: 369

Compile simple c++ project using libuv in visual studio

I just got familiar with libuv and I tried to create really simple project in visual studio and compile it. I built the libuv project like it was written in the documentation. After the build was complete I added, in the linker the include files from libuv's files. Than I added the compiled lib - libuv.lib.

I wrote really small problem just for the purposes of compilation:

#pragma comment (lib, "ws2_32.lib")
#pragma comment(lib, "psapi.lib")
#pragma comment(lib, "Iphlpapi.lib")

#include "stdafx.h"
#include <uv.h>

uv_loop_t *loop;

int main() {

   loop = uv_default_loop();

   return 0;
}      

The problem is that the following error is always shown up:

LNK2019 unresolved external symbol __imp__GetUserProfileDirectoryW@12 referenced in function _uv__getpwuid_r    LibuvThirdTest  D:\LibuvTest\LibuvTest\libuv.lib(util.obj)

Thanks.

Upvotes: 0

Views: 1622

Answers (1)

saghul
saghul

Reputation: 2010

These are all the libraries we link with on Windows, you probably need to add pragmas for all of them: advapi32, iphlpapi, psapi, shell32, user32, userenv, ws2_32.

(The list is taken from uv.gyp)

Upvotes: 3

Related Questions