Saturday, July 7, 2007

Precompiled Headers in Visual Studio

What do you want? Precompiled headers that are automatically rebuilt if a header file changes.

It's easy to do this in Xcode, but not quite so in Visual Studio.

The concepts are the same, but in Visual Studio, there are only two options for precompiled headers:
  • Use Precompiled Header (/Yu); and

  • Create Precompiled Header (/Yc)


So, you can use one (only after you've made it), or you can make it again and again and again....

So how do the VS templates achieve the desired behaviour of building the precompiled headers once, and automatically updating them if any of the header files change??

The entire project is set to "Use Precompiled Headers", except for one file where the build properties are changed: "stdafx.cpp" This file is set to "Create Precompiled Headers". This file contains no code, but includes the header files. So when the header files change, it needs to be recompiled, which creates new precompiled headers.

Seems like a kludgy workaround kind of way to achieve what you want, but once you know how it works, it works.

Thursday, June 14, 2007

Using OpenGL in Windows

You'd think that a graphics library like OpenGL (= Open Graphics Library) would be well supported on lots of systems. Not on Windows, well, at not by Microsoft at least.

It appears that Microsoft stopped officially supporting OpenGL in about 2000. Since then, of course, there have been many advances in graphics hardware, and OpenGL has evolved.

The answer is GLEW. It's not too difficult to use - simply download a binary distribution, add the headers and libraries to your project and you're away. (Building GLEW from source proves to be a bit more difficult.)

Even though Microsoft has such a huge market share in terms of operating systems, they still seem to go out of their way to make things difficult to use any open technologies (or non-Microsoft technologies).

That attitude doesn't breed any love from me.

Thursday, May 10, 2007

Programming for Mac and Windows simultaneously

Welcome to my new blog about programming for Mac and Windows simultaneously.

My background is I'm a professional Sound Editor. I'm making some serious steps into the world of software development. My development experience has been only on Mac systems, dating from the days of Mac OS 8.

My current project involves Audio and OpenGL (for want of an open cross-platform graphics library).

And I'll be writing about some of the challenges I discover and overcome as I move forwards with this project.