어차피 앞에 std:: 다 붙일거면
using namespace std;
필요없잖심
강재호.만해 님이 쓰신 글 :
: 린아 내가 어제 밤에 졸면서 책 보다 보니 햇깔렸나 보다 ^^
:
: 아래 코드 정상 동작하네 ^^ ㅋ
:
:
: //---------------------------------------------------------------------------
: #include <iostream>
: #pragma hdrstop
: #include <string>
: #include <tchar.h>
: //---------------------------------------------------------------------------
: using namespace std;
: #pragma argsused
: int _tmain(int argc, _TCHAR* argv[])
: {
: std::string str;
: std::wstring wstr;
:
: str.append("this is String");
: wstr.append(L"this is wideString");
:
: std::cout << str << std::endl;
: std::wcout << wstr << std::endl;
: return 0;
: }
:
:
:
: Lyn 님이 쓰신 글 :
: : 윗분 말대로 안되는게 정상적 ~_~
: :
: : using namespace std; 를 선언하던가
: :
: : 아니면 string, cout, endl, wstring 앞에 전부 std::를 붙이던가
: :
: :
: : 강재호.만해 님이 쓰신 글 :
: : : string str;
: : : str.append("test");
: : : std::cout << str << endl;
: : : wstring wstr;
: : : wstr.append(L"test");
: : : std::wcout << wstr.c_str() << endl;
: : :
: : : 가장 일반적인 코드인데요...
: : :
: : : std::cout << str << endl; 이 코드가 오률를 발생 시키네요..
: : : [BCC32 Error] main.cpp(30): E2094 'operator<<' not implemented in type 'ostream' for arguments of type 'string'
: : : Full parser context
: : : main.cpp(13): parsing: int wmain(int,wchar_t * *)
: : :
: : : Builder6나 Turbo C++에서는 오류가 발생이 안되는데 왜 이런건지 모르곘네요..
: : :
: : : 혹시나 아시는 분 답변 부탁 드립니다 ^^
|