2009-03-06 20 views
0

Windows XPでC++で単純なHello-worldプログラムを実行する際に問題があります。私はここにポストを書かれている:Windows XPでC++プログラムをコンパイルする

Using the g++ C++ compiler from cygwin

私は問題を述べたと私はいくつかのことを解決し、多くの有用な回答を、受け取ったところ。しかし、私はまだ私のこんにちは世界のプログラムを実行することはできません。してください、私はそこにプログラムを含めて、投稿を見てください。私の友人は、問題なく自分のマシンでこのプログラムを実行することができます。だから、問題は私のシステムやライブラリなどにあるはずですが、私は何を理解することはできません。私の投稿の「編集」セクションには、正確に何のエラーメッセージが含まれています。私はハロー++グラムしようとすると

グラム++ cygwinのシェルからHELLO.CPP

:ここ

は、私はこのようなプログラムをコンパイルしようとすると、私が受け取るものです。 cpp、私は得る:

hello.cpp:1: parse error before character 0357 
hello.cpp: In function 'int main()': 
hello.cpp:'cout' undeclared (first use this function) 
hello.cpp: (Each undeclared identifier is reported only once 
hello.cpp: for each function it appears in.) 
hello.cpp: 'endl' undeclared (first use this function) 
g++.exe: hello.cpp: No such file or directory 
g++.exe: No input files 
g++.exe: hello.cpp: No such file or directory 
g++.exe: No input files 
g++.exe: hello.cpp: No such file or directory 
g++.exe: No input files 
g++.exe: hello.cpp: No such file or directory 
g++.exe: No input files 
g++.exe: hello.cpp: No such file or directory 
g++.exe: No input files 

そして、私が試してみるとDOSコマンドプロンプトから(G ++ HELLO.CPPで再び)プログラムをILE:

私はG ++ HELLO.CPPをしようとすると、私が手:

hello.cpp:1: parse error before character 0357 
hello.cpp: In function 'int main()': 
hello.cpp:'cout' undeclared (first use this function) 
hello.cpp: (Each undeclared identifier is reported only once 
hello.cpp: for each function it appears in.) 
hello.cpp: 'endl' undeclared (first use this function) 

答えて

2

コードに何らかの形で不正な文字があるようです。あなた自身でコードを入力したか、&を貼り付けましたか?後者の場合、コピー元のソースが何らかの形で疑わしいものになっている可能性があります。エディタにコードを直接入力して保存し、再コンパイルしてください。

2

あなたはあなたのコード内の不正な文字を持っています。それは、悪い文字エンコーディングなどによって引き起こされる可能性があります。それをチェックしてみてください。

関連する問題