VS2008下面,新建一个smart device MFC工程,SDK是wince7的,MFC链接方式选择动态链接
直接编译没有问题,但是如果加上这样就无法编译通过
#include <iostream>
void CTestDlg::OnBnClicked()
{
std::cout<<"123";
}
再把工程修改为MFC静态链接也能编译通过。
我十分郁闷。
出错信息
1>TempDlg.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > std::cout" (__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A)
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::width(int)" (__imp_?width@ios_base@std@@QAAHH@Z) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__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) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl std::char_traits<char>::eof(void)" (__imp_?eof@?$char_traits@D@std@@SAHXZ) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::flags(void)const " (__imp_?flags@ios_base@std@@QBAHXZ) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::width(void)const " (__imp_?width@ios_base@std@@QBAHXZ) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (__imp_?length@?$char_traits@D@std@@SAIPBD@Z) referenced in function __catch$103924
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl std::ios_base::rdstate(void)const " (__imp_?rdstate@ios_base@std@@QBAHXZ) referenced in function "public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::setstate(int,bool)" (?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAAXH_N@Z)
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl std::ios_base::clear(int,bool)" (__imp_?clear@ios_base@std@@QAAXH_N@Z) referenced in function "public: void __cdecl std::basic_ios<char,struct std::char_traits<char> >::clear(int,bool)" (?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAAXH_N@Z)
1>TempDlg.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl std::char_traits<char>::to_int_type(char const &)" (__imp_?to_int_type@?$char_traits@D@std@@SAHABD@Z) referenced in function "public: int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sputc(char)" (?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAAHD@Z)