#ifdef _DEBUG
ofstream _of("D:\\Test\\Debugfile.txt", ios_base::app);
_of<<"X:"<<*pnX_<<" "<<"Y:"<<*pnY_<<" "<<"Z:"<<*pnZ_<<" "<<"\n";
#endif
这是我在静态库中的代码,只运行静态库是没问题的,也能输出。但是我把静态库链接到我的应用程序时就报错了
error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ),该符号在函数 "public: virtual bool __thiscall QEC::CQECompensator_ImpV1::DoCompensate(int *,int *,int *)" (?DoCompensate@CQECompensator_ImpV1@QEC@@UAE_NPAH00@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(char const *,int,int)" (__imp_??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z),该符号在函数 "public: virtual bool __thiscall QEC::CQECompensator_ImpV1::DoCompensate(int *,int *,int *)" (?DoCompensate@CQECompensator_ImpV1@QEC@@UAE_NPAH00@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall std::ios_base::width(int)" (__imp_?width@ios_base@std@@QAEHH@Z),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,int)" (__imp_?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char>>(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static bool __cdecl std::char_traits<char>::eq_int_type(int const &,int const &)" (__imp_?eq_int_type@?$char_traits@D@std@@SA_NABH0@Z),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static int __cdecl std::char_traits<char>::eof(void)" (__imp_?eof@?$char_traits@D@std@@SAHXZ),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: int __thiscall std::ios_base::width(void)const " (__imp_?width@ios_base@std@@QBEHXZ),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (__imp_?length@?$char_traits@D@std@@SAIPBD@Z),该符号在函数 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (__imp_?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ),该符号在函数 "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Sentry_base::_Sentry_base(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??0_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z) 中被引用
1>QECompensatorD.lib(QECompensator_ImpV1.obj) : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (__imp_?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ),该符号在函数 "public: __thiscall std::basic_ostream<char,struct std::char_traits<char> >::_Sentry_base::~_Sentry_base(void)" (??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ) 中被引用