[질문] 컴파일 에러인데 어떤 이유로 발생하는지 모르겠습니다.

smileng의 이미지

안녕하세요^^

간단히 g++ 컴파일러를 이용해서 hello.world를 출력하는 예입니다.
실행화일은 잘 만들어 지지만, 컴파일도중에 경고메시지를 보게됩니다.
그런데 그 이유를 잘 모르겠습니다.

소스코드입니다.

#include <iostream.h>

int main()
{
        cout << "Hello, world!" << endl;
        return 0;
}

컴파일 중 경고메시지입니다.

$ g++ foo.cpp
In file included from /usr/include/c++/3.2/backward/iostream.h:31,
                 from foo.cpp:1:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

gcc를 잘못 깐건가요? 왜이런 에러 메시지가 날까요?

seoleda의 이미지

iostream.h 라는 화일은 deprecated 돼었다네요 ^^

현재로썬 iostream.h는 사용하지 않습니다.

#include <iostream> 이라고 쓰는게 표준이죠.

아마도 네임스페이스와 연관되어 위와 같이 쓴다고 알고 있는데.. ^^

그리고 #include <iostream> 아래에 using namespace std; 라는 구문도 추가해야 할겁니다. ^^

그럼 이만 ^^

smileng의 이미지

^^
#include <iostream>
using namespace std;
였군요..
감사합니다.

//--------------------------------------
// Not a Programmer, but.....
// ~ EveryDay MiSo ~
//--------------------------------------