G++ x.h 컴파일 오류 근본적인 원인을 알고 싶습니다

fromODK의 이미지

소스 자체는 에러날것도 없는 간단한 문장이구요..

헤더화일 추가시 #include <iostream.h> #include <stdio.h>

기본적인 헤더화일 두가지만 추가했습니다

한컴 3.1 사용중이고 처음 설치때에는 GCC, G++설치 안했습니다

설치후에 패키지관리자를 통해서 C관련 개발툴들 설치했구요

지금 다시 보니 에러가 아니라 경고가 나오는것 같군요

x.h관련 경고문만 주루륵 나오더니 실행화일은 생성되지만

실행시 아무결과가 없습니다

부탁 좀 드릴께요

불량청년의 이미지

소스라든지, 경고 메시지 나오는것을 보여주셔야죠~

먼지 잘 모르겠네요. ㅜㅜ;

H/W가 컴퓨터의 심장이라면 S/W는 컴퓨터의 영혼이다!

맹고이의 이미지

Quote:
/usr/local/include/c++/3.2.1/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header. Please conside
r using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Exa
mples 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 wa
rning use -Wno-deprecated.

이런 걸 말씀하시는 것 같군요.

#include <iostream>
#include <cstdio>

이런식으로 해보세요.
아니면 컴파일시 -Wno-deprecated 옵션을...

실행결과가 안나오는건
소스를 보여주세요. -_-;

fromODK의 이미지

#include <stdio.h>
#include <iostream.h>

int main()
{
printf("A");
cout << "B";

return 0;
}

실행 g++ -o odk odk.c <-- vi로 편집하고 odk.c로 저장했습니다

윈도우 환경에서 비주얼 툴로 하던것을 G++로 실행하려니

바로 윗분이 말씀하신 저런 경고 메시지가 나오구요

윈도우 환경하고 많이틀릴것 같다는 막연한생각이 드네요

=====================================--------------------------------------------------=============================================
─━┘└━─

맹고이의 이미지

fromODK wrote:
#include <stdio.h>
#include <iostream.h>

int main()
{
printf("A");
cout << "B";

return 0;
}

윈도우 환경에서 비주얼 툴로 하던것을 G++로 실행하려니

바로 윗분이 말씀하신 저런 경고 메시지가 나오구요

윈도우 환경하고 많이틀릴것 같다는 막연한생각이 드네요

제가 많이 몰라서 자세한 설명은 힘들구요...
Standard C++ Library는
#include <iostream>
이렇게 ".h"를 빼고 인클루드 하는게 현재의 표준입니다.
자세한 사항은 요즘 나온 C++책이나
C++ 표준에 대해 구글에서 검색해 보세요... ^^;

#include <iostream> 
#include <cstdio> 
using namespace std;

int main() { 
    printf("A"); 
    cout << "B" << endl; 

    return 0; 
} 


아마도 이렇게 하면 경고가 안나올 것 같습니다. ^^
realian의 이미지

Quote:
/usr/local/include/c++/3.2.1/backward/backward_warning.h:32:2: warning: #warning
This file includes at least one deprecated or antiquated header. Please conside
r using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Exa
mples 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 wa
rning use -Wno-deprecated.

이 파일들에는 더이상 사용이 금지되었거나 구닥다리 헤더파일들이 포합되어 있습니다.
C++ 표준 17.4.1.2에 나오는 32 header중 하나를 이용해 보세요.
예를 들면 C++헤더를 <X.h> 라고 쓰지 말고 <X> 라고 쓰고,
사용금지된 <ssstream.h>를 쓰지 말고 <sstream> 이라고 써보세요.
이 경고를 보고 싶지 않으면 -\no-deprecated 옵션을 사용하세요.

해석해 놓고 보면.. 별로 어렵지 않은 내용이죠..?

못보던 에러 나왔다고 지레 겁먹지 마시고 차근차근 해석해 보세요..
의외로 컴파일러의 메세지들이 문제를 해결하는데 가장 빠른 길을 알려줍니다.

이래서 영어는 기본적으로 할 줄 알아야 한다는 소리도 나오구요... 8)

(중학교때 학원에서 처음 C를 배웠는데..
갈쳐 주던 선생님도 에러메세지 해석을 못하시더군요 ㅡ.ㅡ;;
중 3실력으로도 해석가능한 "...가 빠졌습니다" 정도였는데..
그 때 프로그램 짜면서 영어공부 많이 했던 기억이 납니다... )

..........No Sig.........|
-------------------+

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.