0

I want to use WinHTTP to do some HTTP requests. Really basic stuff, but WinHTTP seems to be kind of complex compared to what I actually just want to do.
Well, I couldn't even get this example code from the msdn to work:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384270%28v=vs.85%29.aspx#code-snippet-1

What I tried is the following:
I created a new win32 console app with precomp header in VC++ 2010.
I added these includes:

#include <windows.h>  
#include <winhttp.h> 

and put the example code in the _tmain function.

When I try to compile it I get the following error:

WinHttpTestings.obj : error LNK2019: unresolved external symbol __imp__[FUNCTIONNAME]@4 referenced in function _wmain  

For every WinHttp function called.

I hope you can help me out, sorry for being such a noob.

Forivin
  • 14,780
  • 27
  • 106
  • 199
  • 1
    Looks like you forgot to bind some lib to your project. – Havenard Apr 10 '14 at 00:20
  • A whole lib? Or do you mean a header file include? – Forivin Apr 10 '14 at 00:22
  • 3
    Yes, aparently, `winhttp.lib`, it has to be associated with your project in order to compile. You can do it by adding it to your linker settings or by adding `#pragma comment(lib, winhttp.lib)` to your headers. – Havenard Apr 10 '14 at 00:24
  • Looks like it worked! Thank you! winhttp.lib needed to be in quotes though. You should add it as real answer. :) – Forivin Apr 10 '14 at 00:29

0 Answers0