{"id":1067,"date":"2011-03-02T21:58:58","date_gmt":"2011-03-03T02:58:58","guid":{"rendered":"http:\/\/bitpost.com\/news\/?p=1067"},"modified":"2011-04-15T20:19:57","modified_gmt":"2011-04-16T01:19:57","slug":"compiling-and-debugging-your-qt-47-phonon-app-with-visual-studio-2010","status":"publish","type":"post","link":"https:\/\/bitpost.com\/news\/2011\/compiling-and-debugging-your-qt-47-phonon-app-with-visual-studio-2010\/","title":{"rendered":"Compiling and debugging your Qt 4.7 phonon app with Visual Studio 2010"},"content":{"rendered":"<p>Qt&#8217;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.<\/p>\n<p>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 <a href=\"http:\/\/qt.nokia.com\/downloads\/sdk-windows-cpp\">Qt SDK for Windows<\/a>.  Free is good!<\/p>\n<p>But this time around, I opted for using Visual Studio 2010, since I already had it installed and I wanted to compare.  I&#8217;ve read that there is no <em>support<\/em> 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 &#8211; it says the add-in &#8220;can be used for development together with all Qt licenses&#8221;.  Let&#8217;s fire it up and try it out!<!--more--><\/p>\n<p>Just the facts, ma&#8217;am:<\/p>\n<ul>\n<li>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!<\/li>\n<li>Install Visual Studio 2010.<\/li>\n<li>Install <a href=\"http:\/\/support.microsoft.com\/kb\/2280741\">this patch<\/a> to fix support for 64-bit apps.<\/li>\n<li>Install the DirectX SDK<\/li>\n<li>Download and unzip the <a href=\"http:\/\/get.qt.nokia.com\/qt\/source\/qt-everywhere-opensource-src-4.7.2.zip\">Qt opensource code<\/a> to [c:\\\\Qt\\4.7.2] (or whatever version you get).<\/li>\n<li>Open a &#8220;Visual Studio command prompt&#8221; and compile Qt as follows.  Note that for phonon, <strong>you MUST compile Qt as shared not static.<\/strong>  You might be able to switch back to static after you build the phonon dll&#8217;s, but I didn&#8217;t try that.\n<pre>nmake confclean\r\nnmake clean\r\necho yes &#62yes.txt\r\nconfigure -debug-and-release -opensource -shared -nomake demos -nomake examples -no-qt3support -qt-sql-sqlite -phonon -phonon-backend -no-webkit -no-script -platform win32-msvc2010 &#60yes.txt\r\nnmake<\/pre>\n<\/li>\n<li>Wait a while for that to finish&#8230; :&#038;#62  Definitely use the above settings to skip the demos and examples if you want to save time.<\/li>\n<li>Because we built shared, you should now have Qt dll&#8217;s (including phonon) in [c:\\\\Qt\\4.7.2\\bin].  Copy the debug versions of dll&#8217;s (*d4.dll) into the directory with your debug exe, and repeat with (*4.dll) for release.<\/li>\n<li>Install the <a href=\"http:\/\/qt.nokia.com\/downloads\/visual-studio-add-in\">Qt Visual Studio Add-In<\/a> (this version works with Visual Studio 2010)<\/li>\n<li>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&#8230;<\/li>\n<li>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!<\/li>\n<\/ul>\n<p>That should be all you need.<\/p>\n<p>FYI&#8230; I had trouble along the way, and explored alternatives.  There are three options I know of at this time, none completely polished yet:<\/p>\n<ul>\n<li>Stock Qt Phonon (we just went through this option)<\/li>\n<li>Gstreamer on Windows &#8211; I believe this is just coming together but working great for some folks<\/li>\n<li>Phonon-VLC &#8211; I don&#8217;t think Qt has this baked in yet, but phonon devs are suggesting it is a superior approach<\/li>\n<\/ul>\n<p>I really don&#8217;t want to spend time debugging beta solutions at this time, as I have a mile-long todo list.  Also, if it&#8217;s possible to avoid a ton of platform-specific code, I&#8217;d be a lot happier.  If the stock phonon gets the job done well enough, good enough for me for now.<\/p>\n<p>Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Qt&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[22,19,4,6],"tags":[59,26,58,28,25],"class_list":["post-1067","post","type-post","status-publish","format-standard","hentry","category-cpp","category-opensource","category-projects","category-windows-projects","tag-compiling","tag-debugging","tag-phonon","tag-qt","tag-visual-studio"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9M11L-hd","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/comments?post=1067"}],"version-history":[{"count":27,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1067\/revisions"}],"predecessor-version":[{"id":1216,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/posts\/1067\/revisions\/1216"}],"wp:attachment":[{"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/media?parent=1067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/categories?post=1067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitpost.com\/news\/wp-json\/wp\/v2\/tags?post=1067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}