相关疑难解决方法(0)

为什么我不应该在标题中加入"using namespace std"?

有人曾暗示不建议在头文件中执行此操作:

using namespace std;
Run Code Online (Sandbox Code Playgroud)

为什么不建议?

它是否会导致像这样的链接器错误:(为了方便而行换行)

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) 
Run Code Online (Sandbox Code Playgroud)

c++ using header-files

1
推荐指数
1
解决办法
1001
查看次数

标签 统计

c++ ×1

header-files ×1

using ×1