Visual Studio 2010 SP1 has been released

For those who are using Visual Studio 2010, the service pack has now been officially released:

Visual Studio 2010 Service Pack 1 General Availability – Visual C++ Team Blog – Site Home – MSDN Blogs

Edit: The download like doesn’t seem to work for me yet, given that it’s only gone General Availability today it might be worth checking back a little later.

Edit again – we have a general availability download link: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5&displaylang=en

If your VS2010 C++ build is constantly rebuilding a project that hasn’t changed…

Check if you’re seeing the following output in the build pane:


InitializeBuildStatus:
  Creating ".unsuccessfulbuild" because "AlwaysCreate" was specified.

I’ve just fixed a bunch of these errors in one of our solutions here and all of these were caused by one of two issues:

  • The project file referenced files that were no present in the source tree
  • A custom build step either was supposed to generate a file but didn’t, or the file ended up in the wrong place

In order to find out if there are missing files that trigger the perma-rebuild, you’ll also have to enable Visual Studio’s debug output as described in this stackoverflow answer.

How to view undecorated DLL-exported C++ symbols in Visual Studio 2010

Yes, it’s one of those “note to self” posts, but I keep forgetting how to do it.

As the first step, you run dumpbin /EXPORTS and redirect the output into a file because the utility that unmangles the names (undname.exe) doesn’t appear to be able to take piped input via stdin. Then, run undname <filename>, with <filename> being the file that contains the exported symbols.

At least that way the symbols become mostly readable.

Boost.Log, preventing the’unhandled exception’in Windows 7 when attempting to log to the event log

I recently ran into a requirements for retrofitting a logging library to an existing project. My first instinct was to throw Pantheios at it as I’ve used it before and It Just Worked. Unfortunately in this case, we needed the ability to log to more than two event sinks and it looked like this was getting a little awkward with Pantheios, which prompted me to look at Boost.Log.

After some digging through the documentation and the samples, I managed to get the logging going to the three event sinks we needed. So far, so good, but every time I started up the program it reported an unhandled exception on Windows 7 when it was trying to initialise the simple_event_log backend and the software wasn’t run as administrator. Curiously enough, the log messages still did appear in the event log, just with lots of unnecessary decoration.

The reason for this problem was that the registry key in HKEY_LOCAL_MACHINESystemCurrentControlSetServicesEventLog that the application needs access to both has to be present (if you’re not administrator, you don’t have the privileges to create it) and the user who runs the application also needs to be able to both read and write to it. Normally you’d need the installer to create the key as it tends to run with administrator privileges; the installer also needs to set the permissions on the created key to ‘Full Control’. Once both the key and the permissions are set correctly, the backend will register OK without any unhandled exceptions.

Unfortunately, if the event log backend can’t create the event log registry entry by itself during its initalisation phase, it is also necessary to point the event log at the file that contains the event messages. In order to do this, the installer also needs to create a string value in the newly added application-specific key that has the name “EventMessageFile” and that points at the correct boost_log dll.

Once the above entries are in the registry, logging to the event log using the simple_event_log backend Just Works, too.

A couple of noteworthy links

It’s bit of a link roundup from the past couple of months. Most of you probably saw these already as I’d think you’re probably reading the same blogs.

C++ links

VS2010 SP1 Beta: What’s in it for C++ developers. While I’m not going to chance installing the beta on my main developer workstation, it looks like there are some interesting features in the service pack. I hope that the IDE stability has also been improved.

Grr… My VC++ Project Is Building Slower in VS2010. What Do I Do Now? (A Step by Step Guide): A good guide showing what to look for when VS2010 builds appear to be slower than VS2008 builds of the same project.

Emacs

Making CamelCase readable with glasses-mode – I’m not a big fan of CamelCase, but I must say this minor mode makes a big difference in readability.

General programming links

Give your programmers professional tools – just too true. I’m extremely lucky that a lot of the companies I worked for including my current employer do recognise that your average developer has different needs than someone working with, say, spreadsheets all day long but some of the hand-me-down boxes with small slow harddrives and slow processors that were inflicted on some dev teams I worked in were definitely putting the brakes on productivity.