QAxBindable::createAggregate() reimplementation building with MS VS 2012 problem
-
Hi, all!
I need to create COM server. I tried to use example from https://qt-project.org/books/view/c_gui_programming_with_qt_4_2nd_edition_the_official_c_qt_book
chapter 23 AxBouncing.
- here authors creates safety sertificate to cheat IE. on my system the project is not built.
I'm using Qt5.2.0 + add-on to MS VS 2012 + MS VS 2012 + update 4 + Win7 SP1 x64
the errors are:
QtCore/qobjectdefs.h(489): error C2027: use of undefined type 'QWidget'
QtCore/qobjectdefs.h(489): error C2056: illegal expression
QtCore/qobject.h(520): error C2338: qobject_cast requires the type to have a Q_OBJECT macro
QtCore/qobject.h(522): error C2027: use of undefined type 'QWidget'
QtCore/qmetatype.h(1264) : see declaration of 'QWidget'
QtCore/qobject.h(522): error C2227: left of '->staticMetaObject' must point to class/struct/union/generic type
QtCore/qobject.h(522): error C2228: left of '.cast' must have class/struct/union
if I add #include <QWidget> in objectsafetyimpl.h I get only one error:
qtwidgets\qwidget.h(741): error C2908: explicit specialization; 'T qobject_cast<QWidget*>(QObject *)' has already been instantiatedbut I can build the project if I throw away QAxBindable::createAggregate() and class ObjectSafetyImpl
why is it so?
- even well compiled server doesn't work in IE - it's well registered with regsvr32.exe... but nothing happens. see3 demo.html from the book.
How to make it work?
the only modifications in project from my side are in .pro (I use axserver instead of qaxserver, 'cuase it's Qt5.2.0 not Qt4.5):
@
TEMPLATE = lib
CONFIG += dll axservergreaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QT += core gui axserverHEADERS = axbouncer.h objectsafetyimpl.h
SOURCES = axbouncer.cpp
main.cpp objectsafetyimpl.cppRC_FILE = qaxserver.rc
DEF_FILE = qaxserver.def
@[edit: added coding tags @ SGaist ]
- here authors creates safety sertificate to cheat IE. on my system the project is not built.