Current version

v1.10.4 (stable)

Navigation

Main page
Archived news
Downloads
Documentation
   Capture
   Compiling
   Processing
   Crashes
Features
Filters
Plugin SDK
Knowledge base
Contact info
Forum
 
Other projects
   Altirra

Search

Archives

01 Dec - 31 Dec 2013
01 Oct - 31 Oct 2013
01 Aug - 31 Aug 2013
01 May - 31 May 2013
01 Mar - 31 Mar 2013
01 Feb - 29 Feb 2013
01 Dec - 31 Dec 2012
01 Nov - 30 Nov 2012
01 Oct - 31 Oct 2012
01 Sep - 30 Sep 2012
01 Aug - 31 Aug 2012
01 June - 30 June 2012
01 May - 31 May 2012
01 Apr - 30 Apr 2012
01 Dec - 31 Dec 2011
01 Nov - 30 Nov 2011
01 Oct - 31 Oct 2011
01 Sep - 30 Sep 2011
01 Aug - 31 Aug 2011
01 Jul - 31 Jul 2011
01 June - 30 June 2011
01 May - 31 May 2011
01 Apr - 30 Apr 2011
01 Mar - 31 Mar 2011
01 Feb - 29 Feb 2011
01 Jan - 31 Jan 2011
01 Dec - 31 Dec 2010
01 Nov - 30 Nov 2010
01 Oct - 31 Oct 2010
01 Sep - 30 Sep 2010
01 Aug - 31 Aug 2010
01 Jul - 31 Jul 2010
01 June - 30 June 2010
01 May - 31 May 2010
01 Apr - 30 Apr 2010
01 Mar - 31 Mar 2010
01 Feb - 29 Feb 2010
01 Jan - 31 Jan 2010
01 Dec - 31 Dec 2009
01 Nov - 30 Nov 2009
01 Oct - 31 Oct 2009
01 Sep - 30 Sep 2009
01 Aug - 31 Aug 2009
01 Jul - 31 Jul 2009
01 June - 30 June 2009
01 May - 31 May 2009
01 Apr - 30 Apr 2009
01 Mar - 31 Mar 2009
01 Feb - 29 Feb 2009
01 Jan - 31 Jan 2009
01 Dec - 31 Dec 2008
01 Nov - 30 Nov 2008
01 Oct - 31 Oct 2008
01 Sep - 30 Sep 2008
01 Aug - 31 Aug 2008
01 Jul - 31 Jul 2008
01 June - 30 June 2008
01 May - 31 May 2008
01 Apr - 30 Apr 2008
01 Mar - 31 Mar 2008
01 Feb - 29 Feb 2008
01 Jan - 31 Jan 2008
01 Dec - 31 Dec 2007
01 Nov - 30 Nov 2007
01 Oct - 31 Oct 2007
01 Sep - 30 Sep 2007
01 Aug - 31 Aug 2007
01 Jul - 31 Jul 2007
01 June - 30 June 2007
01 May - 31 May 2007
01 Apr - 30 Apr 2007
01 Mar - 31 Mar 2007
01 Feb - 29 Feb 2007
01 Jan - 31 Jan 2007
01 Dec - 31 Dec 2006
01 Nov - 30 Nov 2006
01 Oct - 31 Oct 2006
01 Sep - 30 Sep 2006
01 Aug - 31 Aug 2006
01 Jul - 31 Jul 2006
01 June - 30 June 2006
01 May - 31 May 2006
01 Apr - 30 Apr 2006
01 Mar - 31 Mar 2006
01 Feb - 29 Feb 2006
01 Jan - 31 Jan 2006
01 Dec - 31 Dec 2005
01 Nov - 30 Nov 2005
01 Oct - 31 Oct 2005
01 Sep - 30 Sep 2005
01 Aug - 31 Aug 2005
01 Jul - 31 Jul 2005
01 June - 30 June 2005
01 May - 31 May 2005
01 Apr - 30 Apr 2005
01 Mar - 31 Mar 2005
01 Feb - 29 Feb 2005
01 Jan - 31 Jan 2005
01 Dec - 31 Dec 2004
01 Nov - 30 Nov 2004
01 Oct - 31 Oct 2004
01 Sep - 30 Sep 2004
01 Aug - 31 Aug 2004

Stuff

Powered by Pivot  
XML: RSS feed 
XML: Atom feed 

§ Visual Studio 2010 beta 1 fails to build Hello World

Can anyone explain to me how this even passed the nightly build, much less got shipped out as VS2010 beta 1?

Update:
Microsoft has fixed the bug in their internal post-beta 1 builds.

Comments

Comments posted:


No fair - you're obviously running in a configuration that requires a Unicode main function, named _wmain. I presume if you changed the function name to _tmain (tmain? I don't remember for sure) or change the standard library configuration in some way, you would get a successful build. Yes, this should not be the default build configuration, but that's not the same thing as "fails to build Hello World".

Do your usual in-depth analysis; this snarky dismissiveness does not become you.

George - 21 05 09 - 03:20


Wow, that's kinda epic!

GinKage - 21 05 09 - 03:32


Defaulting to a configuration that embraces and extends C so fundamentally that it fails to build Hello World is, in fact, the same as failing to build Hello World.

Glenn Maynard - 21 05 09 - 03:34


It looks like VS2010 is forcing developers down the unicode route. The command line parameters, by default, are being passed to your main as unicode (LPWSTR)

int wmain(int argc, WCHAR* argv[])

So call main wmain and *hopefully* it *should* work. You may also need to use the unicode version of printf (wprintf ?)

MarC - 21 05 09 - 03:53


George, I don't think you understand.

It takes time to download and evaluate a beta, time which I don't have to do other things. And I really don't feel like spending time exploring a C/C++ compiler whose default configuration fails to build the simplest and most fundamental program in the history of the C programming language. Should I test if for loops and builds work too? Sorry, but I expect even beta releases to last more than ten seconds before I find a bug, and I expect it to be in something less fundamental than handling of the main() function. I might do a more in-depth analysis later, but right now this feels like a waste of my time.

Oh, and by the way -- the problem occurs because the default configuration is Unicode, but this is also true of VS2005, where Hello World compiles just fine with Unicode as the project setting.

Phaeron - 21 05 09 - 03:54


MarC:
Introducing WCHAR into the main declaration has the amusing effect of making Hello World non-portable....

Phaeron - 21 05 09 - 03:55


A quick change to one configuration option would make it work the way you expect. To simply call it broken, imply that the testers are asleep at the wheel, and end your analysis there, is simplistic and disingenuous. I'm not even saying you should have kept using the darn compiler, but simply that you ought to have elongated your post a bit and commented on the obvious root cause of the build failure, rather than just throwing your hands up in the air and calling it a bug.

Yes, it's a stupid way to configure a compiler, but it seems like it may be a conscious decision. They've fallen so completely in love with Unicode that they decided to use a default configuration that breaks everything. It's idiotic. So let's talk about that. Rail against their short-sightedness.

I just don't expect someone of your prowess to give up so quickly. Obviously you could fix the build error in 30 seconds or less, as anyone who has used Visual Studio for any reasonable amount of time could do. The root cause is readily apparent from the error message. So I can only conclude that you were so disgusted or insulted by the error that you couldn't bring yourself to go on. Fair enough, but let's not muddy the waters by acting as if you were stymied or this problem was insurmountable.

It's not that I don't understand your position, I can totally see where you're coming from, but I would have preferred that you expound a bit more in your original post and give us some of the opinions you expressed here in the comments section. Instead what we got was a snarky drive-by potshot with a misleading headline, which IMO is not up to your usual standard.

George - 21 05 09 - 04:52


It's nice to see Microsoft continuing to embrace the idea of a standard look & feel in their flagship applications, using the operating system's brilliant, well-designed and well-maintained visual styles engine to draw all of their UI elements so that the program fits in with every other application on the same desktop.

Or rather, it'd be nice if any part of the above sentence was remotely true. :-\

I'm looking forward to the C++0x features but -- DANG! -- I wish whoever was paid to ugly-up that GUI had instead been paid to make the Project Settings GUI not suck in terms of usability, as 64-bit replaces ANSI/Unicode as the reason that every project has to have at least four build configurations.

Leo Davidson (link) - 21 05 09 - 05:20


George:
You're saying that I should have written an extensive writeup on how and why Visual Studio 2010 beta 1 doesn't compile Hello World out of the box? No thanks.

Yes, I did consider it a waste of time, and yes, I did stop looking at VS2010 beta 1 today as a result of it. But for now, I'm going to consider it a simple bug. If Microsoft says they did this on purpose, then maybe I'll rant. You, on the other hand, seem to be taking this very seriously for some reason.

By the way, thanks for insulting me by calling my headline misleading and disingenuous. The last time I checked, the "1 failed" part in the Output Window means that the program didn't build, and the program is a C/C++ standard compliant version of Hello World.

Phaeron - 21 05 09 - 05:39


I think George has a point. You might have already entered total lockdown defense mode, but this article is rather sensationalistic and makes the grazing reader belief VS2010 is broken or violates the C/C++ standards.

If they decided to link to the unicode version of the runtime in the default settings for a new project, that's a weird choice. Report it to Microsoft Connect if you don't like it, that's the whole point of a beta, to gather user feedback.

Cygon (link) - 21 05 09 - 06:43


As far as I know, 3.6.1/1 in the C++ standard requires that the entry point be called main(). There is no mention of wmain/_wmain() or _tmain() being acceptable replacements, which are Microsoft-specific extensions. Therefore, this behavior should be a violation of the standard. Care to point out what I have missed?

And yes, I do consider this broken. There are portions of the C/C++ standards that are sometimes avoided for implementation complexity reasons; this should not be one of them. There is not a single program from Kernighan and Ritchie's "The C Programming Language" that would compile with default settings in this scenario.

I personally don't like the default being Unicode, but there's no reason that has to be tied to this problem. As I've already said, VS2005 works just fine with a Unicode project declaring main(), and I'm pretty sure VS2008 does too.

Phaeron - 21 05 09 - 07:06


Does it make a difference if you include cstdio instead of stdio.h?

Capt. Jean-Luc Pikachu (link) - 21 05 09 - 07:48


It's just a blog. It's just a careless one-liner update on a blog about something that was and is ridiculous.

If someone is actually able to get "misleaded" into believeing that VS2010 beta can't compile "Hello World" no matter what amount of work could be done to make it true by simple virtue of THIS, then this person has far more serious issues than having been misleaded.

Don't listen to the naysayers. Your update was not misleading in any way.

Man, the obvious is obvious.

ParkerLewis - 21 05 09 - 08:24


Is this the new UI? Am I the only one who finds it butt-ugly? I hope I can switch it back to some sane defaults...

-Darkstar

Darkstar - 21 05 09 - 08:26


Off-topic: did they change the chrome to dark to partially alleviate issues with WPF's ClearType implementation?

kiwiblue - 21 05 09 - 08:53


kiwiblue: No, i think they changed the chrome because grey is the new black. It seems all app vendors are going to darker UI colors because it (provably, apparently) causes less eyestrain. Adobe has done this for their whole suite and I think you're going to see a lot more of it out of Microsoft (which started with Expression).

On the Cleartype front: I'm not a Cleartype expert but there is still a visual difference between VS 2008 and 2010 when you put them next to each other with the same code and font. 2010 is a bit thinner and lighter than its counterpart. I haven't used 2010 enough to decide if this is annoying.

Like Leo, I'm really disappointed they didn't spend more time fixing the massive UI issues (like project settings) within VS while they were doing the WPF port. Porting those horrible dialogues to WPF seems like a waste of time. Maybe they'll fix it for the final.

Trimbo (link) - 21 05 09 - 10:00


Wow, I see a lot of interesting comments...

But the fact remain the same: a C/C++ compiler that out-of-the-box FAILS to compile a STANDARD-COMPLIANT C program.

Ok, maybe if you use the OUT-OF-STANDARD unicode version of main() or if you change some weird settings in the compiler, it works fine. But that's not the behaviour that a compiler should have.

TheBishop - 21 05 09 - 10:43


Maybe VC2010 isn't supposed to be C compliant, who knows? I agree the out-of-standard approach that MS typically uses is losing folks.

Rich - 21 05 09 - 11:35


@Trimbo: Microsoft is back to light colors in the chrome for Office 2010. Should we assume the GUI colors follow the same patterns as in the fashion world? In such case, we could reasonably expect extra slim, anorexic applications. Not that it would be a bad thing.

Back to the Hello World, it's certainly major fsckup, no matter the angle you're using to look at it.

kiwiblue - 21 05 09 - 12:56


Guess its still VC6 forever then

asf - 21 05 09 - 15:44


Visual C Classic. Why hasn't Microsoft thought of that? Just to show the old timers they still care...right.

Rich - 21 05 09 - 16:09


By now shouldn't everyone be building their apps as Unicode? If so, there's probably many software developers that aren't writing their programs how they should (reminiscent of how Vista's stricter security exposed several improperly designed programs). It's not far fetched to think Microsoft wants to encourage better programs, so they make Unicode the default.

As far as standards and/or portability, do the C or C++ standards say anything on how main() should accept Unicode (specifically UTF16) arguments? If not, then no matter what MS does, it breaks portability. If they add a new variation of main(), which is not much different from their existing proprietary WinMain(), can they really be accused of standards violations when there isn't any existing standard that handles what they need?

m35 (link) - 21 05 09 - 16:34


@ParkerLewis:
I was pretty pissed off last night, but at this point I'm more amused. Apparently this hit Reddit, and there are some awesome comments there, too. I like the parts where it was suggested that I (a) port Hello World to Unicode, and (b) pointed out obvious Google searches to knowledge base articles that describe the wrong problem. I'm not sure why anyone would think that Hello World is a windowed application or requires ATL. But hey, maybe they don't teach people how to write console applications anymore.

At this point, I'm thinking I should have people write and build Hello World as part of job interviews. It seems like a heck of a good weeder.

As for the new look of VS2010, I'm holding out on judging it until I've actually used it some more. I'm guessing the change was made as a response to the distraction of the gradient bars in VS2005/2008, and although the difference is noticeable, it doesn't seem like it'd be distracting over time.

Phaeron - 21 05 09 - 16:38


@m35:
Setting the Unicode flag doesn't do much unless you are using Win32 APIs or the extensions. If you aren't already using _T() and _t* functions, your code will simply continue to use MBCS functions.

The way that earlier versions of VC++ handle this is that you can declare either main() or wmain(), and the linker will automatically hook up whichever one is used. It has to have logic to do this anyway because main() is a special function in C++ that is called based on whichever variant of parameter list is declared. Therefore, you can either declare the standard main(), or you can declare wmain() directly or via _tmain() to take advantage of the Microsoft-specific extension for a Unicode command line. This seems both compliant and sensible to me.

For a windowed mode application, the CRT and linker do require WinMain or wWinMain, but that of course is not the same as a console mode application. At that point, you do need to pick up your Petzold and port Hello World to Win32. Under the covers, there isn't actually a difference in the Win32 entry point -- this is a change done solely at the linker/CRT level. All that actually needs to change is a single bit in the executable header.

Note that if you do need the Unicode version of the command line, you can always call the Win32 function GetCommandLineW() to retrieve it at any time. I believe this is actually required at the Win32 level since the entry point doesn't actually receive it -- the Win32 entry point is actually like DllMain(), and the arguments to WinMain() are actually formed by the CRT.

Phaeron - 21 05 09 - 17:06


They think ClearType is the greatest thing on Earth, but do not realize there are lcds out there which have rgb components lined up in interesting ways, like triangularish.

Gabest - 22 05 09 - 08:15


@Phaeron:
At this point, I'm thinking I should have people write and build Hello World as part of job interviews. It seems like a heck of a good weeder.

This should get you started:
http://www.infiltec.com/j-h-wrld.htm

Rich - 22 05 09 - 17:44


What is doing printf in a cpp file?

AverageCoder - 28 05 09 - 10:31


printf() is still valid C++. And I hate iostreams.

By the way, if you look in the notes for TCPL 2nd edition, it notes that all of the programs in the book are also valid C++ and were actually tested on a C++ compiler.

Phaeron - 28 05 09 - 15:52


It seems that a lot of bad programmers read this blog when they considered this to be a non-issue.

It was obviously a linker/compiler bug and it goes to show how much they care about C/C++ nowadays and where all resources in developing Visual Studio are wasted.

Igor Levicki (link) - 17 06 09 - 12:02


I just spent at least 2 hours trying to figure out why the linker was complaining about not finding the symbol main.... Oh damn how I hate MS right now....

caca - 07 11 12 - 05:26

Comment form


Please keep comments on-topic for this entry. If you have unrelated comments about VirtualDub, the forum is a better place to post them.
Name:  
Remember personal info?

Email (Optional):
Your email address is only revealed to the blog owner and is not shown to the public.
URL (Optional):
Comment: /

An authentication dialog may appear when you click Post Comment. Simply type in "post" as the user and "now" as the password. I have had to do this to stop automated comment spam.



Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.