Here are quick instructions to get this done and start using TagLib in your project to manipulate tag data in your music files. I had to pull this together from about 5 different places…

NOTE: This was moved to the wiki, because persistent articles belong on wikis, not blogs! 🙂

Why is this not documented well? I don’t understand why people spend man-years creating great software and then don’t bother to document it – did I just miss it somewhere? Prolly…

A new article describing my cross-platform development environment setup is now on the wiki

Updated with more detail on 2011/09/18…

I’m using the cross-platform Qt C++ library to write an app for linux, OS X, and Windows. Qt source can be compiled to a wide range of systems and devices, with two obvious omissions that are not likely to be filled any time soon: iPhone and Android. I know I am going to need client code on these devices, and I know that the client code is going to be extremely similar to the Qt client code. How do you design for this?

Applying the concept of separation of concerns, you design your classes into layers. The base layer consists of high level concept classes that perform all fundamental actions using generic data types. Then, the derived layer is used to get the job done, using the most useful and powerful lower level tools at your disposal. Push everything you can into the base layer, until you hit the limit of non-portable information and data types. It’s a beautiful way to code.

To be more specific, in my case, the base class layer will be using C++, including the STL, which gives me tons of power. I will pull in boost if even more horsepower is needed. The derived class layer for the first round of clients will be Qt-powered. The Qt library has a massive amount of real-world usefulness, supporting everything from http to video playback. I have not gotten to the iPhone and Android clients yet so the whole concept may change, but here’s my current plan. The iPhone code will be Objective C with the C++ base class layer linked in. I will attempt to incorporate the C++ base class layer into the Android code using the NDK.

Here’s a quick example of the layer approach, in this case used to quickly set up profiling using Qt’s QTime class at the lower level: (continued…)

I love my asserts. I use them like crazy throughout my code and catch errors faster than you and your whole testing department. :> The computer does exactly what I ASK of it, which sometimes is not the same as what I EXPECT of it. So I wrap up my expectations with assert macros so my computer friend and I stay on the same page. Happy happy joy joy.

In Qt, we have the Q_ASSERT macro. Qt default behavior is to abort on any Q_ASSERT macro failure. This is weird to me (even if it is common). Almost universally, I want to SEE what’s going on when I hit an assert. Sometimes the assertion turns out to be wrong and may need adjusting. Even if it’s right, sometimes it’s helpful to check the effect of the failed assertion. And certainly, being able to walk back up the stack trace is critical to determine where things went wrong. I can kill the program easily if I WANT to, but I may want to continue – it should be my choice. It’s a no-brainer!

So I don’t use Q_ASSERT. Here’s my cross-platform C++ assert macro hackery. It’s not perfect but it’s getting me by so far… (continued…)

I’m the last person to praise Microsoft – with the amount of money they bleed from the human race, there is no room to give them any slack. To their credit, corporations of their magnitude almost always decay into bureaucracy and inefficiency, and they could be worse. Case in point, Visual Studio. It kicks ass. Here’s a quick rundown of what it does for me when debugging my Qt app. This is in comparison to Qt Creator, which is awesomely streamlined and elegant. But when you are debugging, every bit of comfort is gold:

  • if you set things up as i did, you can step right through the Qt source with no pain
  • the watch window takes far fewer steps to manipulate
  • the debugger can dereference pointers better
  • the debugger can dereference iterators better
  • code completion in the editor can also handle dereferenced iterators
  • debugger can show long strings much better
  • you can step over a function back up to the caller without dropping to the next line of code in the call routine (for when multiple calls take place on one line)
  • debugger doesn’t head south when often browsing out of array bounds (inevitable if you are watching variables)

I’ll add to this list as seems fit. I should probably also start a list of the advantages of Qt Creator, it is really nice to work with on linux and Mac. Including Eclipse would round out the list nicely… but for now, back to teh coding. :> Check out this recent post for instructions on getting VS set up with Qt, it’s easy.