gcc 链接器错误 : undefined reference to `__security_cookie'

标签 gcc curl dll linker

gcc我想建一个DLL ,它使用 Curl 库。


$gcc -shared -o GA_TestLibV11.dll GA_TestLibV11.o GA_TestLibV11.def curllib_static.lib

$ gcc -shared -o GA_TestLibV11.dll GA_TestLibV11.o GA_TestLibV11.def curllib_static.lib -llibws2_32

我收到以下警告(多次出现)

警告:.drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' v
ersion='9.0.21022.8' 处理器架构='x86' publicKeyToken='1fc8b3b9a1e18e3
b'"/DEFAULTLIB:"MSVCRT"/DEFAULTLIB:"OLDNAMES"' 无法识别

以及以下错误:
curllib_static.lib(./Release/easy.obj):(.text[_win32_init]+0x7): undefined reference to `__security_cookie'

curllib_static.lib(./Release/easy.obj):(.text[_win32_init]+0x41): undefined reference to `@__security_check_cookie@4'

c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: curllib_st
atic.lib(./Release/easy.obj): bad reloc address 0x41 in section `.text[_win32_in
it]'
collect2.exe: error: ld returned 1 exit status

我还需要链接什么来解决这些问题?

谢谢。

最佳答案

您将需要与 bufferoverflow.lib 库之一链接,

bufferoverflowU.lib This library implements functionality for security cookie verification that can be used in the user mode and in applications that use the Win32 API. Most applications link to this library.

bufferoverflowK.lib This library implements the check of a security cookie that works in the kernel mode of the operating system. Services and subsystems that run in the kernel mode have to be linked to this library.

bufferoverflow.lib This library implements functionality for security cookie verification that can be used in the user mode. However, bufferoverflow.lib is different from bufferoverflowU.lib because bufferoverflow.lib can be used in services and in applications that do not use the Win32 API.


查看更多 You may receive the "Linker tools error LNK2001" error messages when you build source code by using the Win32 Software Development Kit (SDK) or the Windows Server 2003 Driver Development Kit (DDK) for Windows Server 2003 Service Pack 1 .
或者,您将不得不在没有 /GS 的情况下重建 curl编译器开关,

In Microsoft Visual Studio 2002, a new compiler switch that is named " /GS" has been introduced to the Microsoft Visual C++ compiler. When the " /GS" switch is set, the compiler injects buffer overrun detection code in the compiled code.

关于gcc 链接器错误 : undefined reference to `__security_cookie' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21627607/

相关文章:

linux - Cronjob 卡住而不退出

c - 对 xxx include 的 undefined reference 不起作用

linux - 即使有存档组也无法在 Linux 上链接

php - 警告curl_setopt() 期望参数 2 很长,给定字符串

php - 修改抓取网页中包含的 JavaScript 的最佳方法是什么?

c++ - 如何在exe中包含所有dll?

c++ - 在 VBA 中返回一个对象

c++ - 从 DLL 调用函数时 MFC 断言错误

c++ - 交互设备的定义

c - GCC 链接器 : move a symbol in a specified section