0

I'm fairly new with curl. I need to use curl in c++ with the ssl support. I compiled OpenSSL with nmake and then, and I compiled libcurl as a static library with SLL SUPPORT via the VS10 project. The compilation worked and I tried to build a small console application example : That works !

But, when I try to create an MFC project with these specific properties : MFC as a dialog box, without unicode, and using MFC in a static library. That doesn't work and I got the following unresolved symbols errors :

libcurl.lib(mprintf.obj) : error LNK2001: symbole externe non résolu __imp__fputc
1>libcurl.lib(tftp.obj) : error LNK2001: symbole externe non résolu __imp__memchr
1>libcurl.lib(http.obj) : error LNK2001: symbole externe non résolu __imp__memchr
1>libcurl.lib(userauth.obj) : error LNK2001: symbole externe non résolu __imp__memchr
1>libcurl.lib(file.obj) : error LNK2001: symbole externe non résolu __imp___fstat64
1>libcurl.lib(formdata.obj) : error LNK2001: symbole externe non résolu __imp___stat64
1>libcurl.lib(session.obj) : error LNK2001: symbole externe non résolu __imp___difftime64
1>libcurl.lib(kex.obj) : error LNK2001: symbole externe non résolu __imp___snprintf
1>libcurl.lib(knownhost.obj) : error LNK2001: symbole externe non résolu __imp___snprintf
1>libcurl.lib(scp.obj) : error LNK2001: symbole externe non résolu __imp___snprintf
1>libcurl.lib(misc.obj) : error LNK2001: symbole externe non résolu __imp___snprintf
1>libcurl.lib(transport.obj) : error LNK2001: symbole externe non résolu _imp___snprintf
1>libcurl.lib(channel.obj) : error LNK2001: symbole externe non résolu __imp___wassert
1>libcurl.lib(sftp.obj) : error LNK2001: symbole externe non résolu __imp___wassert
1>libcurl.lib(transport.obj) : error LNK2001: symbole externe non résolu __imp___wassert
1>libcurl.lib(userauth.obj) : error LNK2001: symbole externe non résolu __imp__rewind
1>libcurl.lib(misc.obj) : error LNK2001: symbole externe non résolu __imp__vsnprintf

Thanks in advance.

1 Answers1

0

By default, curl compiles with the /MD (dll) run-time library (that's why you get the __imp__ prefix to the unresolved externals).

I assume you build your MFC project with /MT (statically linked run-time).

You can build curl with static run-time by setting the RTLIBCFG environment variable in your build console to static, like this:

set RTLIBCFG=static

Or just add manually /MT to the compiler flags and /NODEFAULTLIB:MSVCRT.lib to the link flags in the makefiles, in case the first suggestion doesn't work.

Alexandru C.
  • 3,337
  • 1
  • 25
  • 27