Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

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

Author
Message
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 23rd Nov 2012 11:16 Edited at: 23rd Nov 2012 11:17
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:


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

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

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:

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

Many other C++ programs have source files with a .cpp extension, so I thought perhaps I needed to rename my file. I changed its name to helloworld.cpp, but that didn't help. I think there is a very serious bug in Clang because when I tried using it to compile the renamed program, it flipped out, printed "84 warnings and 20 errors generated." and made my computer beep a lot!

What have I done wrong here? Have I missed some critical part of the C++ Standard? Or are all three compilers really just so broken that they can't compile this simple program?

SOURCE!
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 23rd Nov 2012 11:28
That is hilarious!

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 23rd Nov 2012 11:53
I'm guessing it has some erroneous headers/hidden characters. Try creating a new file and re-typing everything in instead of copying and pasting. If that works, it's probably that issue, and you can use a binary/hex file editor to see exactly where the offending data lies. (there seem to be a lot of bloatware-filled hex editor programs, so search around a bit first xD)

Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 23rd Nov 2012 12:06
Quote: "I'm guessing it has some erroneous headers/hidden characters."

Considering that the file the original poster on StackOverflow was trying to compile was a .png, I'd say so.

mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 23rd Nov 2012 12:09 Edited at: 23rd Nov 2012 12:09
@Hodgey hush!
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Nov 2012 15:53 Edited at: 23rd Nov 2012 15:55
Try converting it to an animated .GIF and see if that fixes it.

TheComet

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Nov 2012 16:25
Good one. Had me fooled - all too easy to do sadly.



Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 23rd Nov 2012 18:34
Compiles here, make sure the file is saved in the correct format and in the correct encoding.

You know, UTF-8 rather than RGB.

You're signature has been erased by a mod
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 23rd Nov 2012 23:44
Looks at title... looks at board...



Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 24th Nov 2012 00:29
Quote: "@Hodgey hush!"

Sorry! What I meant to say was try compiling in MS Paint.

mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 24th Nov 2012 09:30
@Hodgey

Next time I will record my voice and try to compile .wav
I hope my british accent will be recognized by compiler!
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Nov 2012 11:59
Quote: "Next time I will record my voice and try to compile .wav
I hope my british accent will be recognized by compiler! "


Like this? (See attached.)



Attachments

Login to view attachments
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 24th Nov 2012 12:05
Quote: "Could not understand command at line 1."
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 24th Nov 2012 17:07
lol, that's the best thing I've seen this week.

RP Functions Library v1.0

My signature has not been erased by a mod.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Nov 2012 22:08
This couldn't possibly be a serious question?

"You're not going crazy. You're going sane in a crazy world!" ~Tick
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 24th Nov 2012 23:29
I guess the same would happen with multiple source files too! ha ha ha

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Nov 2012 00:24
Quote: "This couldn't possibly be a serious question?"


Look at the date the original version was posted - or did "this" refer to your question?



Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 25th Nov 2012 06:30
Quote: "@Hodgey

Next time I will record my voice and try to compile .wav
I hope my british accent will be recognized by compiler!"

Quote: "Quote: "Could not understand command at line 1.""

I believe the compiler should return:
"Terribly sorry sir but there appears to be a spot of bother at line 1. It doesn't not make any sense at all. See what you can do about it chap".

However if you were to try in an Australian accent, it'd probably understand you as it is completely acceptable to make up words on the spot. Now, please excuse me while I squidgery-didge around with my code.

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Nov 2012 07:49
Quote: "Look at the date the original version was posted"

ahh ok

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Rampage
17
Years of Service
User Offline
Joined: 4th Feb 2008
Location: New Zealand
Posted: 25th Nov 2012 12:16
Hahahaha, oh brilliant xD

Login to post a reply

Server time is: 2025-05-20 04:23:04
Your offset time is: 2025-05-20 04:23:04