ld.exe cannot find -lcurl

Feb 13, 2011 at 4:55pm
I'm making a project that's going to use the FTP features of libcurl. Because I am planning on distributing my program, I copied all the header and source files from the libcurl lib folder into my program. When I built my program, I got a load of errors that stuff couldn't find other stuff, so I added libcurl.lib to the additional libraries and -lcurl to other linker options and copied libcurl.lib to my project folder and now the only error I get is 'ld.exe cannot find -lcurl'. I tried adding the project folder (the place where libcurl.lib is) to the linker search paths, but I still get the error. What happened to cause this?

(I posted this on StackOverflow but I got no answers. Hopefully I'll get some here :)
Last edited on Feb 13, 2011 at 4:57pm
Feb 13, 2011 at 6:06pm
You use a gcc port?
Try adding -L with the path where the library is to the compiler command.
Feb 13, 2011 at 7:03pm
I remember trying that, but it still didn't work. (I'm using WinINet now so I don't need to download and setup any libraries because its part of windows :D)
Feb 13, 2011 at 7:08pm
Did you add the right path in your lib directories? If you just plopped the lib in a file, outside of PATH, that is even one directory deeper then the one your compiler is told to look in then it won't find it.
Feb 13, 2011 at 7:17pm
You might also have to specify the -L before the -l.
Feb 14, 2011 at 11:21am
I copied all the header and source files from the libcurl lib folder into my program.
Why? That's not how you use libraries.
Last edited on Feb 14, 2011 at 11:22am
Feb 14, 2011 at 5:02pm
I think he means his project dir.
AFAIK, on Windows it's totally usual to have dlls shipped with released software. There's nothing wrong about having headers etc. somewhere in you project directory...
Feb 14, 2011 at 5:10pm
JoR: I disagree. It's fine to have a local build of a library, but the library should always remain intact as a unit unless you have the need and ability to port and test the library in your environment.

programmer47: I recomend you build and install the library using the library's build mechanism. Do not copy the files into your project, just use the installed library.

When you distribute your application, then distirbute the library with your app as binary. How exactly you do that depends the deployment method/platform and so on.
Last edited on Feb 14, 2011 at 5:12pm
Feb 14, 2011 at 7:19pm
I think we're reading about different things.

I think programmer47 just talked about having a copy of the development files in his project directory for linking and header inclusion...

Edit: which is the right way besides a global installation.
Last edited on Feb 14, 2011 at 7:20pm
Feb 14, 2011 at 7:28pm
I see what you mean. But it's often not easy to build a 3rd Party lib from source without the build system. Plus, it may not work as expected if built with the wrong flags. You just don't know until you test it.
Feb 14, 2011 at 7:34pm
Maybe libcurl.dll is missing?
Topic archived. No new replies allowed.