tags:

views:

33

answers:

1

Hey, firstly thanks for reading this. I am a bit of a noobie c++ programmer with a great idea. For programming this I need to download some HTML off websites. I have chosen libCurl due to perform this task. The libcurl website is of little help to me. Most of the information on their website is outdated or deviates slightly.

So, some more information. I am using Visual C++ 2010 Express. The version of libCurl I am using is http://curl.haxx.se/latest.cgi?curl=win32-devel-msvc. I've moved the contents of the incudes file into the include of VC++. Then I made a new project -> Win32 Console Application and unchecked precompiled header and added #includes in the incudes section. I'm not sure if that is of any use or if it is correct.

Could sombody post step-by-step instructions of how they did it. Obviously I would take any help available.

+1  A: 

I can't post step-by-step instructions, but here are some general pointers about integrating 3rd party libs into your application with VC projects:

  • Add the curl include statement to one or more of your header files: #include <curl/curl.h>. You can do this in any source files that need to access the curl API or you can choose to put it in your stdafx.h (precompiled header). I don't think you need to turn off precompiled headers (I'm not sure why you did that..)

  • Add the library include path (the include directory of the distribution) to the Additional Include directory setting on the compiler tab. This allows the compiler to find the header file(s) mentioned above.

  • Add the library libcurl.lib to the Additional Dependencies on the linker tab. You'll also need to add the root curl distribution directory that contains the library to the Additional Library Directories setting. This tells the linker where to look when resolving library dependencies.

  • when you run your application, it will depend on the libcurl.dll file (in the root of the distribution), so you will also need to make sure that dll is somewhere in your PATH.

One caveat: I have never used the prebuilt curl libraries -- I've always built from source. I do this typically to insure that the libs I'm using are all using the same VC runtime (which changes with each version of the compiler..).

One other note..the package you've referenced does not appear to include SSL support - so you will not be able to deal with https urls using that library. Grab one of the SSL packages if you need to support https.

Hope that helps.

Mike Ellery