C++ 将VS 8.0 lib文件链接到VS 6.0

C++ 将VS 8.0 lib文件链接到VS 6.0,c++,visual-studio,static-linking,C++,Visual Studio,Static Linking,我有一个非常简单的程序(一些简单的计算,“输入一些东西,输出一些东西”),我使用VisualStudio8.0SP2编译成一个lib文件 此lib文件应链接到另一个程序。问题是另一个程序位于具有Visual Studio 6.0的计算机上 编译程序并在lib文件中链接(使用VS 6.0)时,会出现以下错误和警告: 首先是一些警告: Linking... myLib.lib(SeController.o) : warning LNK4044: unrecognized option "ma

我有一个非常简单的程序(一些简单的计算,“输入一些东西,输出一些东西”),我使用VisualStudio8.0SP2编译成一个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)
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:class std::basic_string&_thiscall std::basic_string::operator=(char
常量*)“(?4?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@QAEAAV01@PBD@Z) 已在libcpd.lib(locale0.obj)中定义
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:virtual\uu thiscall std::basic\u ostream::~basic\u ostream(void)”(?1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ)阿尔雷德
在libcpd.lib(iostream.obj)中定义的y
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:virtual\uu thiscall std::basic\u ios::~basic\u ios(void)”(?1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ)已在中定义
libcpd.lib(iostream.obj)
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:virtual\uu thiscall std::basic\u istream::~basic\u istream(void)”(??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ)阿尔雷德
在libcpd.lib(iostream.obj)中定义的y
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:u thiscall std::basic_istream::basic_istream(类std::basic_streambuf*,bool)”(?0$
基本的_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@性病@@@1@_N@Z) 已在libcpd.lib(iostream.obj)中定义
msvcprt.lib(MSVCP60.dll):错误LNK2005:“public:virtual\uu thiscall std::basic\u streambuf::~basic\u streambuf(void)”(?1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) 
已在libcpd.lib(iostream.obj)中定义
msvcprt.lib(MSVCP60.dll):错误LNK2005:“受保护:u thiscall std::basic_streambuf::basic_streambuf(void)”(?$0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ)阿尔雷德
在libcpd.lib(iostream.obj)中定义的y
MSVCRT.lib(MSVCRT.dll):错误LNK2005:_libcd.lib(vsprintf.obj)中已定义vsprintf
MSVCRT.lib(MSVCRT.dll):错误LNK2005:_libcd.lib(crt0dat.obj)中已定义退出
MSVCRT.lib(MSVCRT.dll):错误LNK2005:_atoi已在libcd.lib(atox.obj)中定义
我曾尝试将VS8.0的VisualStudio2005Redistrubate软件包下载到6.0版本的计算机上,但我收到了相同的错误和警告

甚至可以使用6.0编译器从8.0链接到lib文件吗


不能更改已安装的版本(也不能询问为什么有人在使用VS 6.0:))

您可以将应用程序链接到另一个C运行时,即VS 6.0,但我认为这要求两个版本都安装在同一台机器上。我知道您所说的是不同的机器,所以我认为这不是一个选项

如果您可以使用纯C API创建一个动态库,这将使事情变得更简单:)您可以从VS的任何版本使用这样的DLL。

如果您相信本文(引用自),那么不,您不能-

使用不同编译器创建的对象文件和静态库,或 即使是同一个编译器的不同版本,通常 无法链接在一起。此问题不是特定于MinGW:many的 其他编译器互不兼容。从 如果可以,请使用同一编译器的同一版本的源代码

Dll稍有不同。有时您可以链接使用 一个编译器将一个应用程序与另一个编译器编译。这很好 如果DLL是用C编写的,即使应用程序是用C++编写的。 例如,MinGW C++程序通常链接到C运行库。 提供了Windows。DLL也是用C++编写的,工作时间长。 因为您只能通过声明为的C接口与它们通信 如果你不这样做,你可能会得到链接器错误 因为不同的编译器会对C++名称进行不同的修改。