rt,代码如下
(PInt,PFloat,PReal
都是高精类)
printf("PInt Test\n");
PInt A (10), B (4);
std::cout <<"+ "<< A + B << std::endl;
std::cout <<"- "<< A - B << std::endl;
std::cout <<"* "<< A * B << std::endl;
std::cout <<"/ "<< A / B << std::endl;
std::cout <<"% "<< A % B << std::endl;
std::cout << "++ " << ++A << std::endl;
std::cout << "++int " << A++ << std::endl;
std::cout << "gcd " << PInt::gcd(A, B) << std::endl;
std::cout << "lcm " << PInt::lcm(A, B) << std::endl;
std::cout << "value " << A.value() << std::endl;
std::cout << "value_int " << A.value_int() << std::endl;
printf("PFloat Test\n");
PFloat a (10.5), b = (4.5);
std::cout << "+ " << a + b << std::endl;
std::cout << "- " << a - b << std::endl;
std::cout << "* " << a * b << std::endl;
std::cout << "/ " << a / b << std::endl;
std::cout << "++ " << ++a << std::endl;
std::cout << "++int " << a++ << std::endl;
std::cout << "value " << a.value() << std::endl;
std::cout << "value_int " << a.value_int() << std::endl;
std::cout << "value_float " << a.value_float() << std::endl;
printf("PReal Test\n");
PReal _a = (10.5), _b = (4);
std::cout << "+ " << _a + _b << std::endl;
std::cout << "- " << _a - _b << std::endl;
std::cout << "* " << _a * _b << std::endl;
std::cout << "/ " << _a / _b << std::endl;
std::cout << "++ " << ++_a << std::endl;
std::cout << "++int " << _a++ << std::endl;
std::cout << "gcd " << PReal::gcd(_a, _b) << std::endl;
std::cout << "lcm " << PReal::lcm(_a, _b) << std::endl;
std::cout << "value " << _a.value() << std::endl;
std::cout << "value_int " << _a.value_int() << std::endl;
std::cout << "value_float " << _a.value_float() << std::endl;
错误如下
已启动生成...
1>------ 已启动生成: 项目: PCalculator, 配置: Debug x64 ------
1>源.cpp
1>源.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl PInt::PInt(int)" (??0PInt@@QEAA@H@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: virtual __cdecl PInt::~PInt(void)" (??1PInt@@UEAA@XZ),函数 "public: virtual void * __cdecl PInt::`scalar deleting destructor'(unsigned int)" (??_GPInt@@UEAAPEAXI@Z) 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: class PInt & __cdecl PInt::operator++(void)" (??EPInt@@QEAAAEAV0@XZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: class PInt __cdecl PInt::operator++(int)" (??EPInt@@QEAA?AV0@H@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl PInt::value(void)const " (?value@PInt@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl PInt::value_int(void)const " (?value_int@PInt@@QEBAHXZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PInt __cdecl operator+(class PInt const &,class PInt const &)" (??H@YA?AVPInt@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PInt __cdecl operator*(class PInt const &,class PInt const &)" (??D@YA?AVPInt@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PInt __cdecl operator-(class PInt const &,class PInt const &)" (??G@YA?AVPInt@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PInt __cdecl operator/(class PInt const &,class PInt const &)" (??K@YA?AVPInt@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PInt __cdecl operator%(class PInt const &,class PInt const &)" (??L@YA?AVPInt@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class PInt const &)" (??6@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV01@AEBVPInt@@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: static class PInt __cdecl PInt::gcd(class PInt,class PInt)" (?gcd@PInt@@SA?AV1@V1@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: static class PInt __cdecl PInt::lcm(class PInt,class PInt)" (?lcm@PInt@@SA?AV1@V1@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator+(class PFloat const &,class PFloat const &)" (??H@YA?AVPFloat@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator-(class PFloat const &,class PFloat const &)" (??G@YA?AVPFloat@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator*(class PFloat const &,class PFloat const &)" (??D@YA?AVPFloat@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator/(class PFloat const &,class PFloat const &)" (??K@YA?AVPFloat@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator++(class PFloat &)" (??E@YA?AVPFloat@@AEAV0@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PFloat __cdecl operator++(class PFloat &,int)" (??E@YA?AVPFloat@@AEAV0@H@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class PFloat const &)" (??6@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV01@AEBVPFloat@@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl PFloat::PFloat(double)" (??0PFloat@@QEAA@N@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl PFloat::value(void)const " (?value@PFloat@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl PFloat::value_int(void)const " (?value_int@PFloat@@QEBAHXZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: float __cdecl PFloat::value_float(void)const " (?value_float@PFloat@@QEBAMXZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator+(class PReal const &,class PReal const &)" (??H@YA?AVPReal@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator-(class PReal const &,class PReal const &)" (??G@YA?AVPReal@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator*(class PReal const &,class PReal const &)" (??D@YA?AVPReal@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator/(class PReal const &,class PReal const &)" (??K@YA?AVPReal@@AEBV0@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator++(class PReal &)" (??E@YA?AVPReal@@AEAV0@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class PReal __cdecl operator++(class PReal &,int)" (??E@YA?AVPReal@@AEAV0@H@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class PReal const &)" (??6@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV01@AEBVPReal@@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl PReal::PReal(int)" (??0PReal@@QEAA@H@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl PReal::PReal(double)" (??0PReal@@QEAA@N@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl PReal::PReal(class PReal const &)" (??0PReal@@QEAA@AEBV0@@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl PReal::value(void)const " (?value@PReal@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: int __cdecl PReal::value_int(void)const " (?value_int@PReal@@QEBAHXZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: float __cdecl PReal::value_float(void)const " (?value_float@PReal@@QEBAMXZ),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: static class PReal __cdecl PReal::gcd(class PReal,class PReal)" (?gcd@PReal@@SA?AV1@V1@0@Z),函数 main 中引用了该符号
1>源.obj : error LNK2019: 无法解析的外部符号 "public: static class PReal __cdecl PReal::lcm(class PReal,class PReal)" (?lcm@PReal@@SA?AV1@V1@0@Z),函数 main 中引用了该符号
1>C:\Users\Administrator\Desktop\PCalculator\x64\Debug\PCalculator.exe : fatal error LNK1120: 40 个无法解析的外部命令
1>已完成生成项目“PCalculator.vcxproj”的操作 - 失败。
========== 版本: 0 成功,1 失败,0 更新,0 跳过 ==========
========== 占用时间 00:03.470 ==========