2012-04-10 11 views
0

g ++やlinuxについては初心者ですが、私が書いたC++プログラムをコンパイルしようとしています。私のインクルードと、文字通りC + +インクルードファイル(stdio.h、string.hなど)から数千行のエラーが出ます。私は下にそれらのいくつかを貼り付け:C++ヘッダーファイルの奇妙なg ++コンパイラエラー

本当に奇妙である何
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 

、私はまったく同じ別のディレクトリに異なるプログラムの前に含まれており、すべてが(まだ)うまくコンパイルに使用していることです。私がそれらをすべてコメントし、インクルードを使用するコードをコンパイルしても問題ありません。私がコメントを含むインクルードを使用してコードを保持しているが、インクルードの1つでもコメントすると、すべてのエラーが再び発生します。

この1つのディレクトリで失敗するように私の環境に何か問題がありますか?

+0

'/ usr/include/root /'?そのディレクトリを作成したのは何ですか? – sarnold

+0

ルートデータ解析ソフトウェアをインストールしました – user1042305

+0

潜在的なエラーを特定できるようにコードを投稿する必要があります。しかし、埋め込まれたリンクエラーの原因となっているコードのどこかに構文エラーがあるようです。コードの構文エラーを確認して、ここに投稿してください。 –

答えて

2

最も可能性の高い原因:例えば、あなたが#includeTH1F.hヘッダをINGのさ、およびそのほかのヘッダに、あなたが不足しているセミコロンを持っています

// some other header 
struct Foo { 
.... 
} 
^ missing ;