레드햇 8.0에서 Hello, World를 g++로 컴파일하니...

johnny의 이미지

#include <iostream.h>

int main()
{
        cout << "Hello, world\n";

        return 0;
}

이렇게 Hello, World를 찍는 프로그램을 레드햇 리눅스 8.0에서 컴파일하니,

Quote:

$ g++ c.cpp -o c.out
In file included from /usr/include/c++/3.2/backward/iostream.h:31,
from c.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.
$

요렇게 나오네요.. 무슨 말인가요? 읽어도 잘 모르겠네용... ^^

warning인지라, c.out 은 이상없이 실행됩니다.

알려주세용~

jinhoy의 이미지

음... 별건 아니에요, Header 파일을 써줄 때, 좀 간단히 쓸 수 있거든요.

예를 들어 지금 첫 줄에 #include <iostream.h>라고 쓴 거를

#include <iostream>이라고 쓸 수 있다라는 거지요. 결코 큰 문제가

있는 것은 아니니까 안심하세요.

cinsk의 이미지

말 그대로 해석하면,

이 파일은 오래된 (호환성이 없거나) 헤더 파일이나, 곧 (제거될) 헤더를 썼습니다.
C++ 표준 17.4.1.2장에 나온 32개의 헤더 중 하나를 쓰는 것을 생각해 보기 바랍니다. 예를 들면 <X.h>란 헤더를 포함하는 것보다 <X>를 포함하는 것이 났습니다.
또 <strstream.h>보다 <sstream>을 포함하는 것이 좋습니다. 이런 종류의 경고를 원치 않는다면 컴파일할 때 -Wno-deprecated 옵션을 쓰기 바랍니다.

왜냐하면, 예전에 C++ 표준이 제정되기 전까지는 각 회사별로 자기들만의 iostream 라이브러리를 써서 만들었기 때문에 서로 호환성이 없었습니다. 있다하더라도 이미 표준이 제정된 이상 표준 라이브러리를 쓰는 것이 더 좋겠죠.

<iostream.h>같은 경우, 비표준 헤더 파일의 대표격인 셈입니다. 보시는 책이 아직도 <iostream.h>를 쓰고 있다면, 최신의 책을 구해서 보시는 것이 도움이 될 것입니다.

(표준) iostream에 관한 사항은 "Standard C++ IOStreams and Locales"란 책에 아주 잘 설명되어 있습니다.

표준을 안 가지고 계신 것 같은데, 표준 17.4.1.2에 나온 헤더를 여기에 옮겨 봅니다.

<algorithm> <iomanip> <list> <ostream> <streambuf> <bitset> <ios> <locale> <queue> <string> <complex> <iosfwd> <map> <set> <typeinfo> <deque> <iostream> <memory> <sstream> <utility> <exception> <istream> <new> <stack> <valarray> <fstream> <iterator> <numeric> <stdexcept> <vector> <functional> <limits>

또, C에서 쓰던 라이브러리 헤더 파일 <X.h>의 경우, <cX>로 존재하는 경우가 많습니다. 예를 들어 <stdio.h>라면 <cstdio>를 포함하죠.

<cassert> <ciso646> <csetjmp> <cstdio> <ctime> <cctype> <climits> <csignal> <cstdlib> <cwchar> <cerrno> <clocale> <cstdarg> <cstring> <cwctype> <cfloat> <cmath> <cstddef>

그럼 이만,

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.