簡體   English   中英

將VS 8.0 lib文件與VS 6.0鏈接

[英]Link VS 8.0 lib file with VS 6.0

我有一個非常簡單的程序(一些簡單的計算,“輸入一些東西,取出一些東西”),然后使用Visual Studio 8.0 SP2將其編譯為一個lib文件。

該lib文件應鏈接到另一個程序。 問題是其他程序在具有Visual Studio 6.0的計算機上。

編譯程序並鏈接到lib文件(使用VS 6.0)時,會出現以下錯誤和警告:

首先是一些警告:

    Linking...
myLib.lib(SeController.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
myLib.lib(SeController.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
myLib.lib(SeController.o) : warning LNK4044: unrecognized option "alternatename:??$get_name@Vinvalid_argument@std@@@Exception@Impl@Core@@YAPBDXZ=?get_name@Exception@Impl@Core@@YAPBDXZ"; ignored
myLib.lib(SeController.o) : warning LNK4078: multiple ".CRT" sections found with different attributes (40300040)
myLib.lib(bt_errors.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
myLib.lib(bt_errors.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
myLib.lib(SCtrlImpl.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
myLib.lib(SCtrlImpl.o) : warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored

....(這里只是一些警告。有相同類型的嗡嗡聲)

然后(一些)錯誤:

msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char
 const *)" (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) already defined in libcpd.lib(locale0.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_ostream<char,struct std::char_traits<char> >::~basic_ostream<char,struct std::char_traits<char> >(void)" (??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ) alread
y defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in
 libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_istream<char,struct std::char_traits<char> >::~basic_istream<char,struct std::char_traits<char> >(void)" (??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ) alread
y defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: __thiscall std::basic_istream<char,struct std::char_traits<char> >::basic_istream<char,struct std::char_traits<char> >(class std::basic_streambuf<char,struct std::char_traits<char> > *,bool)" (??0?$
basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z) already defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) 
already defined in libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll) : error LNK2005: "protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ) alread
y defined in libcpd.lib(iostream.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _vsprintf already defined in libcd.lib(vsprintf.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _exit already defined in libcd.lib(crt0dat.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _atoi already defined in libcd.lib(atox.obj)

我嘗試將VS 8.0的Visual Studio 2005 Redistrubate程序包下載到具有6.0的計算機上,但是出現了相同的錯誤和警告。

甚至可以用6.0編譯器鏈接8.0中的lib文件嗎?

不能更改已安裝的版本。 (不要問為什么有人使用VS 6.0 :))

您可以將您的應用程序鏈接到另一個C運行時,即VS 6.0,但是我認為這要求兩個版本都安裝在同一台計算機上。 我了解您在談論不同的機器,因此我認為這不是一個選擇。

如果您可以使用普通的C API創建動態庫,則將使事情變得簡單得多:)您可以從任何版本的VS使用此類DLL。

如果您認為此文本(引自不同編譯器品牌創建的庫的互操作性 ),則不能,您不能-

用不同的編譯器甚至是同一編譯器的不同發行版創建的目標文件和靜態庫通常無法鏈接在一起。 這個問題不是MinGW特有的:許多其他編譯器互不兼容。 如果可以,請使用相同版本的相同編譯器從源代碼構建所有內容。

Dll略有不同。 有時,您可以將用一個編譯器構建的DLL鏈接到用另一個編譯器編譯的應用程序。 如果DLL是用C編寫的,即使應用程序是用C ++編寫的,這也能很好地工作。 例如,MinGW C ++程序通常鏈接到Windows隨附的C運行時庫。 只要您僅通過用extern“ C”聲明的C接口與它們進行通信,用C ++編寫的DLL也可以工作。 否則,可能會出現鏈接器錯誤,因為不同的編譯器對C ++名稱的處理方式有所不同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM