Qt’s Phonon library has an awesome goal: abstract video and audio services to simplify cross-platform development. It has worked great for me out of the box using Qt 4.7 on linux and Mac OS X. Windows setup took a bit of elbow grease. Here are the cheatnotes to get you through it quickly.

NOTE: The Qt mingw setup worked fine for me when I was setting up my first Windows development environment, do not hesitate to go that route. All you need is the Qt SDK for Windows. Free is good!

But this time around, I opted for using Visual Studio 2010, since I already had it installed and I wanted to compare. I’ve read that there is no support for using the open-source-licensed Qt with Visual Studio, but the official Qt download page for the Visual Studio Add-In clears things up – it says the add-in “can be used for development together with all Qt licenses”. Let’s fire it up and try it out!

Just the facts, ma’am:

  • Get a copy of the source for your cross-platform Qt app, ideally already tested and working on another platform, on your Windows box. Use git, whee!
  • Install Visual Studio 2010.
  • Install this patch to fix support for 64-bit apps.
  • Install the DirectX SDK
  • Download and unzip the Qt opensource code to [c:\\Qt\4.7.2] (or whatever version you get).
  • Open a “Visual Studio command prompt” and compile Qt as follows. Note that for phonon, you MUST compile Qt as shared not static. You might be able to switch back to static after you build the phonon dll’s, but I didn’t try that.
    nmake confclean
    nmake clean
    echo yes >yes.txt
    configure -debug-and-release -opensource -shared -nomake demos -nomake examples -no-qt3support -qt-sql-sqlite -phonon -phonon-backend -no-webkit -no-script -platform win32-msvc2010 <yes.txt
  • Wait a while for that to finish… :&#62 Definitely use the above settings to skip the demos and examples if you want to save time.
  • Because we built shared, you should now have Qt dll’s (including phonon) in [c:\\Qt\4.7.2\bin]. Copy the debug versions of dll’s (*d4.dll) into the directory with your debug exe, and repeat with (*4.dll) for release.
  • Install the Qt Visual Studio Add-In (this version works with Visual Studio 2010)
  • Open Visual Studio. You should see a nice new Qt menu item sandwiched between View and Project. Select [Qt->Qt Options], hit Add, and browse to the source directory. With any luck Qt will enable the OK button for ya…
  • Select [Qt->Open Qt Project (.pro)], browse to your project, and load it up. Visual Studio will spend a few minutes getting comfortable with all the Qt headers, and then you should be able to compile and debug just like you do with all your skanky (j/k) Windoze code. Yay!

That should be all you need.

FYI… I had trouble along the way, and explored alternatives. There are three options I know of at this time, none completely polished yet:

  • Stock Qt Phonon (we just went through this option)
  • Gstreamer on Windows – I believe this is just coming together but working great for some folks
  • Phonon-VLC – I don’t think Qt has this baked in yet, but phonon devs are suggesting it is a superior approach

I really don’t want to spend time debugging beta solutions at this time, as I have a mile-long todo list. Also, if it’s possible to avoid a ton of platform-specific code, I’d be a lot happier. If the stock phonon gets the job done well enough, good enough for me for now.

Have fun!


  1. […] 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 […]

  2. […] monitoring, etc. Useless. If you can, switch to Visual Studio to build Qt apps under windoze. See these posts […]

Leave a Reply