在 VS 2010 C++ 中编译项目时出错

ale*_*gas 2 c++ compilation visual-studio-2010

我正在尝试在 VS 2010 中编译我创建的一个项目,一个软件管理程序。在 VS6 和 VS2005 中,它可以完美编译。

1 - Visual Studio 6 2 - Visual Studio 2005 3 - Visual Studio 2010

原始版本有一些我想稍后修复的错误,但首先我需要它来编译。

使用 VS 6 和 VS 2005,它可以完美编译。

我添加了与每个需要它的文件(.cpp)相对应的库#pragma comment(lib, "bufferoverflowU.lib" )

但是,它没有解决任何与 bufferoverflowU.lib 的问题

错误是:

1>------ Operación Volver a generar todo iniciada: proyecto: Gestion_v1, configuración: Release Win32 ------
1> StdAfx.cpp
1> WDoS.cpp
1> Helpers.cpp
1> Gestion.cpp
1> WWW.cpp
1>WWW.cpp(141): warning C4018: '<' : no coinciden signed/unsigned
1>WWW.cpp(136): warning C4101: 'dwTmp' : variable local sin referencia
1>WWW.cpp(481): warning C4244: '=' : conversion from 'DWORD' to 'char'; possible loss of data
1>WWW.cpp(482): warning C4244: '=' : conversion from 'DWORD' to 'char'; possible loss of data
1> Generando código...
1>LINK : warning LNK4108: /ALIGN specified without /DRIVER; image may not run
1>WDoS.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "unsigned long __stdcall WDoS_HTTP(void *)" (?WDoS_HTTP@@YGKPAX@Z)
1>Gstion.obj : error LNK2001: unresolved external symbol ___security_cookie
1>WWW.obj : error LNK2001: unresolved external symbol ___security_cookie
1>WDoS.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function "unsigned long __stdcall WDoS_HTTP(void *)" (?WDoS_HTTP@@YGKPAX@Z)
1>Gestion.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4 
1>WWW.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
1>.\Release/Gestion_v1.exe : fatal error LNK1120: 2 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?谢谢

IIn*_*ble 5

您未解析的外部是使用/GS(Buffer Security Check) 编译器标志进行编译的结果,但未与 CRT ( /NODEFAULTLIB)链接。如果/GS未指定,则默认启用。您可以尝试通过指定来禁用缓冲区安全检查/GS-

或者,您可以尝试添加所需的代码段。__security_cookie在Visual Studio 附带的 CRT 源中声明<process.h>和定义<gs_cookie.c>。由于您还明确指定WinMain为入口点并且不依赖 CRT 来执行所需的初始化,因此您必须调用__security_init_cookie自己。可能还有更多内容需要编译,但这应该作为一个起点。