Qt With Visual Studio 2010 Setup (SDK 6.x)

Qt is great platform that allows for easy to build GUI applications, and will help make software more portable, as perhaps the future of Ultrasonix platforms lies in multiple platform supports.

Required Programs

 * Windows 7 or Windows XP SP3
 * Visual Studio 2010
 * Qt Library for VS 2010
 * Get the Windows libraries compiled under Visual Studio to ensure the proper linker files are packaged. Note the full Windows SDK does not include the proper linker files, but rather MinGW compiled libraries. The full SDK does however include QtCreator, a nice free IDE if you want to go down a VS free route.
 * Version 4.8.1 is released at time of this writing

Visual Studio Setup

 * Ensure Qt DLL's are in the Windows PATH environment variable (i.e. C:\Qt\4.8.0\bin)
 * Configure a new empty project in Visual Studio
 * Project settings
 * C++
 * Include Qt include directory (i.e. C:\Qt\4.8.0\include)
 * Linker
 * Set the sub-system to Windows, or Console if you want to have a console window floating around with your application
 * Include Qt library directory (i.e. C:\Qt\4.8.0\lib)
 * At minimum you'll want to link to QtGuiX.lib and QtCoreX.lib, where X is the Qt version (4 at the time of writing this).

Simple Example
If you use the Windows sub-system in your linker settings, the below code will work with no linking errors. If you use the Console sub-system, and are OK with having a console window floating around, just remove the #ifdef block.


 * 1) include 

int main(int argc, char **argv) {   QApplication app(argc, argv); QWidget window; window.resize(320, 240); window.show; window.setWindowTitle(Application::translate("toplevel", "Top-level widget")); return app.exec; }


 * 1) ifdef WIN32
 * 2) include 

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {   return main(__argc, __argv); }
 * 1) endif