1

Im trying to compile this code,

 #include <curl/curl.h>


int main(void)
{
  CURL *curl;

  curl = curl_easy_init();

}

with this command:

g++ -I../curl/include/curl -L../curl/lib  -DCURL_STATICLIB src/main.cpp -o main.exe -llibcurl_a

I get lots of errors like

../curl/lib/libcurl_a.lib(../builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib/easy.obj):(.text$mn+0x4): undefined reference to `__security_cookie'
../curl/lib/libcurl_a.lib(../builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib/easy.obj):(.text$mn+0x13e): undefined reference to `@__security_check_cookie@4'
../curl/lib/libcurl_a.lib(../builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib/easy.obj):(.text$mn+0x2d): undefined reference to `_imp__WSACleanup@0'
../curl/lib/libcurl_a.lib(../builds/libcurl-vc12-x86-release-static-ipv6-sspi-winssl-obj-lib/easy.obj):(.text$mn+0x7): undefined reference to `__security_cookie'

I think it is a problem with the linker but i have no idea how to fix it. If you need more information just let me know.

Would be great if somebody could help me.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055

1 Answers1

2

You will need to link with one of the bufferoverflow.lib libraries or rebuild lib curl without the /GS compiler switch.

What is happening is that lib curl has been built with a buffer overflow protection switch /GS The Visual C++ compiler added enhanced protection to lib curl. The compiled code cannot link because the linker cannot resolve the references to __security_cookie so it is on you to make sure you are linking the buffer overflow library containing the __security_cookie symbol.

More information about this error can be found at: https://support.microsoft.com/en-us/help/894573/you-may-receive-the-linker-tools-error-lnk2001-error-messages-when-you

Cinder Biscuits
  • 4,880
  • 31
  • 51