【发布时间】:2010-07-06 12:42:42
【问题描述】:
曾经有人暗示不建议在头文件中这样做:
using namespace std;
为什么不建议这样做?
会不会导致这样的链接器错误:(为方便起见,换行了)
error LNK2005: "public: __thiscall std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >::
~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >
(void)" (??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ)
already defined in tools.lib(Exception.obj)
【问题讨论】:
-
我什至没有放入我的 .cpp 文件。我更喜欢使用
std::vector<std::string>等
标签: c++ header-files using