无法编译通过的Hello World

在stackoverflow上的一个问题如下:

Why is this program erroneously rejected by three C++ compilers?

I am having some difficulty compiling a C++ program that I’ve written.

This program is very simple and, to the best of my knowledge, conforms to all the rules set forth in the C++ Standard. I’ve read over the entirety of ISO/IEC 14882:2003 twice to be sure.

The program is as follows:

enter image description here

Here is the output I received when trying to compile this program with Visual C++ 2010:

c:\dev>cl /nologo helloworld.png
cl :Command line warning D9024 : unrecognized source file type 'helloworld.png',object file assumed
helloworld.png : fatal error LNK1107: invalid or corrupt file: cannot read at 0x5172

Dismayed, I tried g++ 4.5.2, but it was equally unhelpful:

c:\dev>g++ helloworld.png
helloworld.png: file not recognized:File format not recognized
collect2: ld returned 1exit status

I figured that Clang (version 3.0 trunk 127530) must work, since it is so highly praised for its standards conformance. Unfortunately, it didn’t even give me one of its pretty, highlighted error messages:

c:\dev>clang++ helloworld.png
helloworld.png: file not recognized:File format not recognized
collect2: ld returned 1exit status
clang++: error: linker (via gcc) command failed withexit code 1(use-v to see invocation)

To be honest, I don’t really know what any of these error message mean.

其中的一个回答:

另外一个回答:

Try this way:

enter image description here

share

来源:http://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers

同志们好! Hello World!

//@iRyanJ:同志们好;Hello World!!!!同志们辛苦啦!!!!Programing is fun!!!!!
【程序员方阵】各位观众:由程序员组成的方阵走过来了,他们手拿绿色鼠标,虽然他们面色憔悴,脚步蹒跚,那是因为他们为了客户,坚持不懈的努力改下去,但是他们的内心是火热的,支持祖国经济发展的决心是前所未有的!问候:程序员你们辛苦了!!回答声响彻整个广场:为了客户死了都要改!!

一句话证明你是程序员

//@Stephen-Cheng:总把KFC当成MFC//@古人来者也有人抢了:要理解递归,首先要理解递归。 //@没情调的程序男:me.isProgramer=TRUE; //@喝茶_看戏:对象都找不到,整天还用oop//@Edwin昺缺钱:Hello World! (//@小龙云_梦宿:还是那句: 烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫
一句话证明你是程序员。

Hello Kitty

@Lorenzo_Von_Matterhorn:一日和一个很是美好的学妹聊天,她突发奇想的说要做指甲,而且要是那种特有创意,带字母的那种。我便问如果要做美甲,上面的字是什么。她得意的道:首先右手是Hello5个字母。我一听大有高山流水遇知音之感,喜不自禁说道:那左手一定是World咯?她顿了顿,幽幽得说:Kitty。