2012-04-10 2 views
0

g ++ 및 Linux와 관련하여 초보자입니다.하지만 작성한 C++ 프로그램을 컴파일하려고하는데 g ++에서 문제가있는 이유가 무엇이든간에 내 포함, 그리고 말 그대로 C에서 오류의 수천 줄을 + 포함 파일 (예 : stdio.h, string.h, 등). 나는 아래 그들 중 몇 가지를 붙여 :이상한 g ++ 컴파일러 오류가 C++ 헤더 파일에서 발생했습니다

정말 이상한 무엇
In file included from /usr/include/stdio.h:75, 
      from /usr/include/root/Rtypes.h:33, 
      from /usr/include/root/TObject.h:31, 
      from /usr/include/root/TNamed.h:26, 
      from /usr/include/root/TAxis.h:25, 
      from /usr/include/root/TH1.h:25, 
      from /usr/include/root/TH1F.h:25, 
      from torusMC.cpp:10: 
    /usr/include/libio.h: In function ‘int _IO_feof(_IO_FILE*)’: 
    /usr/include/libio.h:462: error: expected primary-expression before ‘,’ token 
    /usr/include/libio.h:462: error: ‘printf’ was not declared in this scope 
    /usr/include/libio.h:462: error: ‘exit’ was not declared in this scope 
    /usr/include/libio.h: In function ‘int _IO_ferror(_IO_FILE*)’: 
    /usr/include/libio.h:463: error: expected primary-expression before ‘,’ token 
    /usr/include/libio.h:463: error: ‘printf’ was not declared in this scope 
    /usr/include/libio.h:463: error: ‘exit’ was not declared in this scope 

, 나는 똑같은 다른 디렉토리에 다른 프로그램에 대한 이전 포함하고 모두가 (여전히) 잘 컴파일 사용하고 있다는 점이다. 만약 내가 그들을 모두 주석 처리하고 include를 사용하는 코드를 컴파일하면 좋다. 주석을 포함하는 코드를 사용하여 코드를 유지하는 경우에도 include 중 하나라도 주석을 추가하면 모든 오류가 다시 발생합니다.

내 환경에 이상이있어이 디렉토리에서 오류가 발생합니까?

+0

'/ usr/include/root /'? 그 디렉토리는 무엇을 만들었습니까? – sarnold

+0

루트 데이터 분석 소프트웨어를 설치했습니다. – user1042305

+0

잠재적 인 오류를 식별 할 수 있도록 코드를 게시해야합니다. 하지만 코드 어딘가에 구문 오류가있어 임베디드 연결 오류가 발생하는 것 같습니다. 코드 오류를 확인하고 여기에 게시하여 볼 수 있도록하십시오. –

답변

2

가장 큰 원인 : 당신이 #includeTH1F.h 전에 다른 헤더를 보내고 있으며, 다른 헤더에, 당신이 누락 된 세미콜론이, 예를 들어,

// some other header 
struct Foo { 
.... 
} 
^ missing ; 
관련 문제