1

I'm trying to use curl from within my windows c++ app but keep running into problems.
I'm using visual studio 2013 on a windows 8.1 machine.
Here's what I've done so far:

  1. Cloned the repo from github
  2. Built the libcurl project which produced three files: libcurl.dll, libcurl_imp.lib and libcurl_imp.exp
  3. In my app project I added the curl include directory to the Additional Include Directories
  4. Added the libcurl_imp.lib to the Additional Dependencies
  5. Built my project

When I run my executable it says:

the program can't start because libcurl.dll is missing from your computer

I found a few things on it, but they solved it by adding the libcurl dll along with the exe, which isn't what I'm looking for as I want my executable to contain the libcurl so that it will work on machines without the need to have the dll.

Any ideas?
Thanks.


Edit

The 2nd step is done pretty much straight forward, I just right clicked on the project (libcurl) and chose buiild.
Due to the comments I've rebuilt it after changing the Configuration Type to Static library, so now it only produces one file: libcurl.dll which, as far as I know not a static library...


2nd edit

I wasted too much time on getting http functionality, and based on the info which I found thanks to a comment here (using libcurl without dll) I've decided to abandon this approach, and I found something which suits my needs perfectly and is simple to install/use: C++ REST SDK (codename "Casablanca")

Community
  • 1
  • 1
Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
  • No dlls means you need a static build, which doesn't seem the case now. You don't tell how exactly you did step 2, but first line in winbuild/makefile.vc is `!IF "$(MODE)"=="static"` so I would guess you have to set MODE to static in your build system. – stijn Oct 27 '14 at 11:20
  • You need to build cURL as a static library – Captain Obvlious Oct 27 '14 at 11:20
  • I do not have a file names `makefile.vc`, only cmake make files.. I edited my question with how I build the libcurl. Thanks. – Nitzan Tomer Oct 27 '14 at 12:25

1 Answers1

0

Try to add libcurl.dll directory to PATH environment variable.

smg628
  • 179
  • 1
  • 5
  • As I wrote in my question, I do not want my app to be depended on whether or not the user has libcurl, and so putting it in the path does not help. – Nitzan Tomer Oct 27 '14 at 12:26
  • Give libcurl.dll to your users. Put it in the same directory your executable is in. – n. m. could be an AI Oct 27 '14 at 12:33
  • That's no an ideal solution, and it will be hard for me to implement and distribute. There must be a way to include the lib in the executable. – Nitzan Tomer Oct 27 '14 at 12:39
  • If you absolutely need a single-file distribution, you have to figure out how to build `libcurl_static.lib` and link to it *and* have static versions of libraries it depends upon *and* link to these libraries too, see [here](http://stackoverflow.com/questions/3411259/using-libcurl-without-dll). – n. m. could be an AI Oct 27 '14 at 13:55
  • I see. In that case, thanks a lot for the info, I think I'll pass on using curl then. I think I found a simpler solution (for my scenario), microsoft's REST sdk. – Nitzan Tomer Oct 28 '14 at 12:49