曾經有人暗示,在頭文件中這樣做,不建議:爲什麼我不應該在標題中放置「using namespace std」?
using namespace std;
爲什麼不勸?
莫非導致鏈接錯誤是這樣的:(linewrapped爲了方便)
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)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected])
already defined in tools.lib(Exception.obj)
不完全相同:http://stackoverflow.com/questions/1265039/using-std-namespace – 2010-07-06 12:46:55
我什至不把我的.cpp文件。我傾向於使用'std :: vector'等 –
2011-11-11 22:38:15