cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: 7.18.2: Compilation with MS Visual Studio 2005 causes error C2894 / extern "C" problem

From: Yang Tse <yangsita_at_gmail.com>
Date: Thu, 2 Oct 2008 01:56:39 +0200

2008/10/1, Stefan Krause wrote:

> I have got a C++ file which includes the curl.h header and which cannot be
> compiled. The following error is generated
>
> C:\Program Files\Microsoft Platform SDK for Windows Server 2003
> R2\Include\wspiapi.h(44) : error C2894: templates cannot be declared to have
> 'C' linkage
>
> The file's content is:
>
> extern "C"
> {
> #include "curl/curl.h"
> }

As you might already know...

Never, never, never include a header inside an extern "C" block.

If trying to compile the following still gives the same error you
might be better served by your compiler vendor.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
int main()
{
}

-- 
-=[Yang]=-
Received on 2008-10-02