Paths below are based on a standard install of the QT SDK (as of 8/1/2012) with a base directory
named "Qt" directly located in C:\. Adjust accordingly.
It also assumes an install of the Qt Visual Studio addin
QT_PATH => C:\Qt\Desktop\Qt
QT_DIR => %QT_PATH%\4.8.1\msvc2010
QT_PLUGINS_DESIGNER => %QT_DIR%\plugins\designer\
*****FOR DESIGNER******
//Auto-load qt libraries you'll reference and some other convenient settings
Create a Qt Designer Plugin project in visual studio (file, new, project, ..)
//This makes the dll usable by designer
In the <PLUGIN_PROJECT_NAME> -> Properties -> Configuration Properties -> General ->
set output directory to QT_PLUGINS_DESIGNER
set configuration type to "Dynamic Library (.dll)" //if it isn't already
--optionally you may also build it a second time with another output directory.
Either way, the below "Your_desired_lib_folder" references the output directory of
this plugin. If you use multiple directories, be sure to build to each one each time.
*****FOR USE IN PROJECTS*****
//This makes the dll usable by other executables/code
If (the following steps are confusing, refer to "Reference 1"){
For each class in this <PLUGIN_PROJECT_NAME> you'll need to add __declspec(dllimport)
(in the header file)
--E.G. "class foo" becomes "class __declspec(dllimport) foo"
For each member function of said class NOT DEFINED IN THE HEADER FILE you'll need to
add __declspec(dllexport) before the function in the source file.
--E.G. "void bar(){}" becomes "__declspec(dllexport) void bar(){}"
}
//Tells the project which library you'll be using (in addition to what is already loaded)
In the <PLUGIN_USER_PROJECT_NAME> -> Properties -> Configuration Properties -> Linker -> Input
Add that <Your_Plugin_Name>.lib to your "Additional Dependencies"
//Allows your project to find the .lib file
In the <PLUGIN_USER_PROJECT_NAME> -> Properties -> Configuration Properties -> Linker -> General
Add that <Your_Desired_Lib_Folder> to your "Additional Library Directories"
//Allows project to find your .dll
In the <PLUGIN_USER_PROJECT_NAME> -> Properties -> Configuration Properties -> Debugging
Add your <Your_desired_lib_folder> to your PATH variable. Seperate it via a semicolon:
--E.G.<CURRPATH> would now be <CURRPATH>;<Your_Desired_Lib_folder>
References:
1 -
http://www.codeguru.com/cpp/cpp/cpp_...-Beginners.htm
Bookmarks