Visual studio 2010 无法调试我的c++;程序:错误LNK2038:检测到的不匹配

Visual studio 2010 无法调试我的c++;程序:错误LNK2038:检测到的不匹配,visual-studio-2010,visual-c++,gmp,Visual Studio 2010,Visual C++,Gmp,我刚刚安装了MPIR库。我已经测试过,程序可以在空代码中看到头文件,如下所示: #include <iostream> #include <conio.h> using namespace std; #pragma warning(disable: 4800) #include <mpirxx.h> #pragma warning(default: 4800) int main (int argc, char *argv[]) { mpz_cla

我刚刚安装了
MPIR
库。我已经测试过,程序可以在空代码中看到头文件,如下所示:

#include <iostream>
#include <conio.h>
using namespace std;

#pragma warning(disable: 4800)
#include <mpirxx.h>
#pragma warning(default: 4800)

int main (int argc, char *argv[])
{   
  mpz_class aBigPO2;

  aBigPO2 = 1073741824; //2^30
  aBigPO2*=aBigPO2; //2^60
  aBigPO2*=aBigPO2; //2^120
  aBigPO2*=aBigPO2; //2^240
  aBigPO2*=aBigPO2; //2^480
  aBigPO2*=aBigPO2; //2^960
  aBigPO2*=aBigPO2; //2^1920 
 // cout << aBigPO2 << endl;

cout<<"Hello World";
getch();
}
#包括
#包括
使用名称空间std;
#杂注警告(禁用:4800)
#包括
#杂注警告(默认值:4800)
int main(int argc,char*argv[])
{   
mpz_类aBigPO2;
aBigPO2=1073741824;//2^30
aBigPO2*=aBigPO2;//2^60
aBigPO2*=aBigPO2;//2^120
aBigPO2*=aBigPO2;//2^240
aBigPO2*=aBigPO2;//2^480
aBigPO2*=aBigPO2;//2^960
aBigPO2*=aBigPO2;//2^1920
//cout所有输出都是最新的。
1> mpirxx.lib(osmpz.obj):错误LNK2038:检测到“\u迭代器\u调试\u级别”不匹配:值“0”与Main.obj中的值“2”不匹配
1> mpirxx.lib(osdoprnti.obj):错误LNK2038:检测到“\u迭代器\u调试\u级别”不匹配:值“0”与Main.obj中的值“2”不匹配
1> mpirxx.lib(osfuns.obj):错误LNK2038:检测到“\u迭代器\u调试\u级别”不匹配:值“0”与Main.obj中的值“2”不匹配
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:void_uthiscall std::basic_ios::setstate(int,bool)”(?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:_int64 _thiscall std::ios_base::width(_int64)”(?width@ios_base@标准@@QAE_J_J@Z)已在mpirxx.lib(osfuns.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:u int64_uuthiscall std::basic_streambuf::sputn(char const*,uu int64)”(?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:class std::basic\u streambuf*\u thiscall std::basic\u ios::rdbuf(void)const”(?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@性病@@@2@XZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:char\uu thiscall std::basic\u ios::fill(void)const”(?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ)已在mpirxx.lib(osfuns.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:int\uu thiscall std::ios\u base::flags(void)const”(?flags@ios_base@std@@QBEHXZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:_int64 _thiscall std::ios_base::width(void)const”(?width@ios_base@std@@QBE_JXZ)已在mpirxx.lib(osfuns.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:class std::basic_ostream&u thiscall std::basic_ostream::flush(void)”(?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:class std::basic_ostream*uu thiscall std::basic_ios::tie(void)const”(?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@性病@@@2@XZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:bool\uu thiscall std::ios\u base::good(void)const”(?good@ios_base@std@@QBE_NXZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> msvcprtd.lib(MSVCP100D.dll):错误LNK2005:“public:void\uuu thiscall std::basic\uostream::\uosfx(void)”(?\uosfx@$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ)已在mpirxx.lib(osdoprnti.obj)中定义
1> c:\users\myuser\documents\visual studio 2010\Projects\gcdgmp\Debug\gcdgmp.exe:致命错误LNK1169:找到一个或多个多重定义符号
1>
1> 生成失败。
1>
1> 时间流逝00:00:00.14
======生成:0成功,1失败,0最新,0跳过==========

我该怎么办?

字符串文字的最大长度为16384(16K)字节(CPP)。您是否检查了(2^1920=9.49711451 x 10577)是否属于此范围?

尝试添加#include for mpir.h,看看是否可以修复它。

您已经获得了该库的发布版本,它与您的调试和CRT设置不兼容。从源代码构建该库的调试版本。您能用步骤说明更多信息吗。@Hans Passant:我是使用x64和release创建库的设置。与我使用这些库的项目相同。我的设备使用英特尔Xeon的Win X64。我的Visual C++被下载到程序文件(x86)中。我再次构建了我的项目,得到了:<代码>链接:致命错误LNK1181:无法打开输入文件MPIR。LIB’< /COD>。这里有什么问题吗?如何解决它。我可以通过在项目-右键单击Projt:Projix:Calp配置属性-> C++目录来修复后者错误,然后选择库目录并添加导航到目录WHER。e库文件是(我的:c:/mpir/win64/release)。
1>InitializeBuildStatus:
1>  Touching "Debug\gcdgmp.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>mpirxx.lib(osmpz.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Main.obj
1>mpirxx.lib(osdoprnti.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Main.obj
1>mpirxx.lib(osfuns.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Main.obj
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(__int64)" (?width@ios_base@std@@QAE_J_J@Z) already defined in mpirxx.lib(osfuns.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE_JPBD_J@Z) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::rdbuf(void)const " (?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: char __thiscall std::basic_ios<char,struct std::char_traits<char> >::fill(void)const " (?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ) already defined in mpirxx.lib(osfuns.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: int __thiscall std::ios_base::flags(void)const " (?flags@ios_base@std@@QBEHXZ) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: __int64 __thiscall std::ios_base::width(void)const " (?width@ios_base@std@@QBE_JXZ) already defined in mpirxx.lib(osfuns.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall std::basic_ostream<char,struct std::char_traits<char> >::flush(void)" (?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: class std::basic_ostream<char,struct std::char_traits<char> > * __thiscall std::basic_ios<char,struct std::char_traits<char> >::tie(void)const " (?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: bool __thiscall std::ios_base::good(void)const " (?good@ios_base@std@@QBE_NXZ) already defined in mpirxx.lib(osdoprnti.obj)
1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "public: void __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Osfx(void)" (?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in mpirxx.lib(osdoprnti.obj)
1>c:\users\myuser\documents\visual studio 2010\Projects\gcdgmp\Debug\gcdgmp.exe : fatal error LNK1169: one or more multiply defined symbols found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========