Take the 2-minute tour ×

If I try to compile a sample code from std.net.curl

import std.net.curl;

void main() {
    auto smtp = SMTP("smtps://smtp.gmail.com");
    smtp.setAuthentication("from.addr@gmail.com", "password");
    smtp.mailTo = ["<to.addr@gmail.com>"];
    smtp.mailFrom = "<from.addr@gmail.com>";
    smtp.message = "Example Message";

I get the following error message:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
 Warning 2: File Not Found curl.lib
--- errorlevel 8

I've been to http://curl.haxx.se/ but I don't know what exactly to do with the many files it has. I don't see curl.lib anywhere.

Edit Here's what I did to get it to work

Everything seems to beworking OK now, although I don't have to link with curl.lib when compiling.

share|improve this question
I think you might need to build the curl.lib –  ratchet freak Jan 23 '13 at 20:23
Ah yes, you don't have to link explicitly because the std.net.curl file includes this cool line: pragma(lib, "curl");, which does it automatically. And since you put the .lib straight in the lib folder, the linker had no trouble finding it. –  Adam D. Ruppe Jan 25 '13 at 22:51
add comment

2 Answers

up vote 4 down vote accepted

The answer to this question should help:

Where is "curl.lib" for DMD?

When you compile your app, you need to add curl.lib to the command line, and that question asks how to build curl.lib.

share|improve this answer
add comment

dmd's download page contains a link to dmd compatible curl, so you can download and install curl from there. Then you need to link in curl.lib when compiling with dmd.

share|improve this answer
The link is dead, I'm afraid –  fwend Jan 24 '13 at 19:09
@fwend Then that's worthy of a bug report: d.puremagic.com/issues/show_bug.cgi?id=9388 –  Jonathan M Davis Jan 24 '13 at 19:19
add comment

Your Answer


