Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I'm trying to set up the Qt Win Migration framework to use Qt in an existing MFC based application. I want to use the framework as a library, so I ran
qmake
on the
qtwinmigrate/buildlib/buildlib.pro
file to create a Visual Studio vcxproj project file. I built the framework as a dll/lib and put the headers in a common include directory. In my MFC project, I added the Qt migration framework's lib as a dependency, included the headers where appropriate and added the code to test the framework. Everything compiles fine, but then I get a linker error:
error LNK2001: unresolved external symbol "public: static struct QMetaObject const QWinWidget::staticMetaObject" (?staticMetaObject@QWinWidget@@2UQMetaObject@@B)
According to
this forum post
, a preprocessor definition must be added to the MFC project that's using the Qt Win Migration framework as a library. Simply add
QT_QTWINMIGRATE_IMPORT
to the project settings under
Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions
.
For a more in-depth explanation into why this is necessary, see
this blog post
.
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.