Compile KDChart v2.4.3 using Qt4.8.7+MinGW

//2016-1-3: begin comments:
If you are going to build KDChart with Qt5, those Makefiles willnot be an issue anymore. The problems come from those Qt functionsthat are obsolete in Qt5, such as:

(1) qVariantValue(obj) is obsolete, which replaced byobj.value()

(2) qFindChild(obj, name) is obsolete, which is replaced byobj->findChildren(name)

(3)QPixmap::serialNumber is obsolete, which is replaced byQPixmap::cacheKey()

(5) QApplication::UnicodeUTF8 is obsolete

(6) QRegion::intersect is obsolete, which is replaced byQRegion::intersected

(7) QString::fromAscii is obsolete, which is replaced byQString::fromLatin1

(8) QGraphicsScene::itemAt is obsolete

(9) QGraphicsItem::setAcceptsHoverEvents is obsolete, which isreplaced by QGraphicsItem::setAcceptHoverEvents

(10) QAbstractItemModel::reset() is obsolete

As a result, you have to modify lots of source codes in order tobuild KDChart2.dll successfully. If you have trouble, you may sendme an email to get my copy. Enjoy;)
//2016-1-3: end of comments
cd C:\KDChart
configure.bat -shared -release
set PATH=C:\KDChart\bin;%PATH%
set LIB=C:\KDChart\lib;%LIB%

modify Makefiles:

C:\KDChart\src\Makefile

C:\KDChart\kdchartserializer\src\Makefile

C:\KDChart\uitools\Makefile

C:\KDChart\plugins\Makefile.plugins_plugin.Release

C:\KDChart\plugins\Makefile.plugins_plugin.Debug

C:\KDChart\plugins\ Makefile.plugins_lib

remove the “/GR /EHsc /wd4251” compiler options as shown below:


make 
The g++ compiler will complain about “_hypot”:

From stackoverflow.com, I found that:


Modify C:\MinGW\include\math.h as suggested by Keith:


make install
The default installation directory is C:\KDAB\KDChart-2.4.3

Be sure to add: C:\KDAB\KDChart-2.4.3\lib to the PATH environment variable, and copy the plugin\kdchart_plugin2.dll to $QTDIR/plugins/designer.

PS1: one last job, the C:\KDChart\include won't be copiedto C:\KDAB\KDChart-2.4.3\include.

cd c:\KDChart\include
qmake
make install 
PS2: How to build QT+KDChart+MinGW projects?

Make sure to add "QT+= svg" to the .pro file, or you will get runtimeerror!

Done!

猜你喜欢

转载自blog.csdn.net/jeffyko/article/details/79333408