2013-01-06 43 views
2

我試圖編譯一個項目,我在VS 2010中創建了一個軟件管理程序。在VS6和VS2005中,它編譯完美。在VS 2010中編譯項目時出錯C++

1 - 視覺工作室6 2 - Visual Studio 2005的3 - Visual Studio 2010中

原來的版本有一些錯誤,我想以後解決,但首先我需要它來編譯。

隨着VS 6和VS 2005的編譯完美。

我增加了庫的#pragma評論(LIB, 「bufferoverflowU.lib」)對應於每個需要的文件(的.cpp)

但是,它並沒有與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 *)" ([email protected]@[email protected]) 
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 @[email protected] referenced in function "unsigned long __stdcall WDoS_HTTP(void *)" ([email protected]@[email protected]) 
1>Gestion.obj : error LNK2001: unresolved external symbol @[email protected] 
1>WWW.obj : error LNK2001: unresolved external symbol @[email protected] 
1>.\Release/Gestion_v1.exe : fatal error LNK1120: 2 unresolved externals 
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== 

任何想法? 謝謝

+0

你能把你的錯誤翻譯成英文嗎?如果這些都是英文的話,更廣泛的受衆將能夠幫助診斷問題。 – Cornstalks

+0

好的,我已經翻譯成英文 –

+0

[你有沒有試過這個主題做了什麼?](http://www.pcreview.co.uk/forums/unresolved-external-symbol-___security_cookie-t1428747.html) – Cornstalks

回答

3

你無法解析的外部是與/GS編譯的結果(緩衝安全檢查)編譯器標誌,但不能鏈接到CRT(/NODEFAULTLIB)。如果未指定/GS,則默認爲啓用。您可以嘗試通過指定/GS-來禁用緩衝區安全檢查。

或者,您可以嘗試添加您需要的代碼段。 __security_cookie<process.h>中聲明,並在<gs_cookie.c>中定義爲隨Visual Studio提供的CRT源的一部分。由於您還明確指定了WinMain作爲入口點,並且不依賴CRT來執行所需的初始化,因此您必須自己撥打__security_init_cookie。可能還有更多需要編譯的內容,但這應該是一個起點。

+0

對不起,但找不到和/ GS或/ GS-命令,但找不到。 –

+0

@aleksander :'''隨Visual Studio一起發貨,除非你使用的是Express Edition,它位於' \ VC \ crt \ src'下'/ GS'是一個編譯器開關,不是命令 – IInspectable

+0

OK ,我找到了gs_cookie.c文件,但爲什麼不鏈接到我的Visual Studio中,我使用Visual Studio 2010專業版(試用版)而不是快速版本,但/ GS說不識別省略 –

-4

確保您的項目沒有設置爲unicode。你的圖書館可能是不同的。
嘗試:項目屬性 - >配置屬性 - >常規 - >字符集=沒有設置

好吧,試試這個問題:
error LNK2001: unresolved external symbol

+0

鏈接器錯誤與字符編碼問題無關。 – IInspectable

+0

已經提出了不起作用的想法,我嘗試了所有可用的選項,並獲得更多的utf-8錯誤,但沒有錯誤_security_cookie,感謝您的幫助 –

+0

編譯器代碼:'/OUT:".\Release/Gestion_v1.exe「/INCREMENTAL:NO/NOLOGO「odbc32.lib」「odbccp32.lib」「ws2_32.lib」「wininet.lib」「kernel32.lib」「user32.lib」「gdi32.lib」「winspool.lib」「comdlg32.lib 「」advapi32.lib「」shell32.lib「」ole32.lib「」oleaut32.lib「」uuid.lib「/ NODEFAULTLIB/MANIFEST /ManifestFile:".\Release\Gestion_v1.exe.intermediate.manifest」/ ALLOWISOLATION/MANIFESTUAC :「level ='asInvoker'uiAccess ='false'」/PDB:".\Release/Gestion_v1.pdb「/ SUBSYSTEM:WINDOWS/PGD:」C:\ Gestion - copia \ Release \ Gestion_v1。pgd「/ TLBID:1/ENTRY:」WinMain「/ DYNAMICBASE/NXCOMPAT/MACHINE:X86/ERRORREPORT:QUEUE' –