Qt 5.1 - QSound / QtMultimedia

415 views
Skip to first unread message

Luigi Ferraris

unread,
Jun 10, 2013, 1:20:17 PM6/10/13
to qtcon...@googlegroups.com
Hi Pritpal

First of all: I'm using Qt 5.1 on MsWinXp

I want use QSound; for this reason I have uncommented line hbqt/qtmultimedia/hbqtmultimedia.hbp on file qtcontribs.hbp.
Library libhbqtmultimedia.a was created.

So, I add hbqtmultimedia.hbc to my.hbp file, but i receive these errors:
hbmk2: Linker command:
g++.exe C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/oop000.o "C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/md-field.o" "C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/md-record.o" "C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/md-tabel.o" "C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/xxx-msgbox.o" C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/hbmk_f8k7af.o C:/DOCUME~1/luigi/IMPOST~1/Temp/hbmk_45mybt.dir/hbmk_scqu8x.oᅵᅵᅵ -Wl,--nxcompat -Wl,--dynamicbase -mwindows -Wl,--start-group -lgtqtc -lsupc++ -lhbqtcore -lQt5Core -lhbqtgui -lQt5Gui -lQt5Widgets -lQt5PrintSupport -lhbqtnetwork -lQt5Network -lhqlev -lhqlcpp -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlibᅵᅵ -Wl,--end-group -s -ooop000.exeᅵ -LD:/HMiniGui/harbour/lib/win/mingw -LD:/HMiniGui/harbour/lib/3rd/win/mingw -LD:/HMiniGui/harbour/addons/hqlev/lib -L"D:/Qt/Qt5.1.0/5.1.0-beta1/mingw47_32/lib" -LD:/HMiniGui/harbour/addons/hbqt/lib/win/mingw
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x46): undefined reference to `_imp___ZN6QSound4stopEv'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x77): undefined reference to `_imp___ZNK6QSound14loopsRemainingEv'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0xa7): undefined reference to `_imp___ZNK6QSound5loopsEv'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0xd7): undefined reference to `_imp___ZNK6QSound10isFinishedEv'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x132): undefined reference to `_imp___ZN6QSound8setLoopsEi'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x4dd): undefined reference to `_imp___ZN6QSoundC1ERK7QStringP7QObject'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x635): undefined reference to `_imp___ZN6QSoundC1ERK7QStringP7QObject'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x79f): undefined reference to `_imp___ZN6QSound4playEv'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x82f): undefined reference to `_imp___ZN6QSound4playERK7QString'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0xa7d): undefined reference to `_imp___ZN6QSoundC1ERK7QStringP7QObject'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0xbd5): undefined reference to `_imp___ZN6QSoundC1ERK7QStringP7QObject'
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0xcdd): undefined reference to `_imp___ZNK6QSound8fileNameEv'
d:/qt/qt5.1.0/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o): bad reloc address 0x0 in section `.data'
d:/qt/qt5.1.0/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
hbmk2[oop000]: Error: Running linker. 1

I think there are several errors into:
- hbqtmultimedia.hbc
ᅵᅵ A) probably we must add some test to check Qt version (like in gtqtc.hbc) ie:
ᅵᅵᅵᅵᅵ {(allwin|os2)&!HBMK_HAS_QT5}libs=QtMultimedia4
ᅵᅵᅵᅵᅵ {(allwin|os2)&HBMK_HAS_QT5}libs=Qt5Multimedia

ᅵᅵ B) probably, we do not need these lines to build end program because already present into hbqt.hbc; I think, hbqtmultimedia.hbcᅵ can be added to my.hbp as an "extension" of hbqt
ᅵᅵᅵᅵᅵ libs=../qtcore/hbqtcore.hbc
ᅵᅵᅵᅵᅵ libs=../qtgui/hbqtgui.hbc
ᅵᅵᅵᅵᅵ libs=../qtnetwork/hbqtnetwork.hbc
ᅵᅵᅵᅵᅵ
ᅵᅵᅵᅵᅵ
About hbqtmultimedia.hbm,ᅵ probably it's ok, but I'm not sure related with different Qt name
ᅵᅵ
At the end, I don't know if libQt5MultimediaQuick_p.a and / or libQt5MultimediaWidgets.a are required. I can't check/test without compiled library.

Many thanks in advance.

Luigi Ferraris

Pritpal Bedi

unread,
Jun 10, 2013, 3:18:04 PM6/10/13
to qtcon...@googlegroups.com, luigfe...@gmail.com
Luigi

So, I add hbqtmultimedia.hbc to my.hbp file, but i receive these errors:
D:/HMiniGui/harbour/lib/win/mingw/libhbqtgui.a(QSound.o):QSound.cpp:(.text+0x46): undefined reference to `_imp___ZN6QSound4stopEv'


Delete addons/hbqt/.hbmk  .and addons/hbqt/lib folder and rebuild again.
You have some residual left-overs from previous version.


Pritpal Bedi 

Pritpal Bedi

unread,
Jun 10, 2013, 3:27:02 PM6/10/13
to qtcon...@googlegroups.com, luigfe...@gmail.com
Hi

I did not read your question properly.

Till Qt 4.x QSound has been a member of QtGui module.
By Qt 5.x it is a member of QtMultiMedia.

Still I am unable to find a solution how to achieve this 
change. The only way is if we deprecate Qt 4.x support.


Pritpal Bedi 

Luigi Ferraris

unread,
Jun 11, 2013, 11:56:03 AM6/11/13
to Pritpal Bedi, qtcon...@googlegroups.com
Ok I understand the problem. I think Qt 5 it's the future, so I think we
can't have a binding to an "older" (give me a cent for this) version.
I don't know if can be possibile, but the idea is: in some way we have
two different QSound.qth (probably with the same code....).
While we compile qtcontribs, can be tested HBMK_HAS_QT5 (see gtqtc.hbc
or other hb envar) and we can enable/include qtgui/qth/QSound.qth OR
qtmultumedia/qth/QSound.qth

I don't know if this IS the only case but probably in the future (or
today) we will have other; ie. today we have QPrinter:setNumCopies( n )
but this is a deprecated (obsolete) method with Qt 4.8 the new method is
setCopyCount( n ).

A) One solution can be to split project qtcontribs into (ie) hbqt_4
(meaning Qt 4.x.x compatible) and hbqt_5 (meaning Qt 5> compatible)
B) Another way is to have a system to "intercept" IN A CLEAR AND UNIQUE
method (not only by hbmk2): what Qt release are you using? Qt4? Qt5?
etc. and we must to be able to include / exclude files (I don't know
using hbmk2 scripts, I haven't clear idea how can be done, but...)

Probably B) solution is more "flexible" and open; the first one is more
robust to avoid problem like (ie) "I can't compileQtContribs....What Qt
version are you using?".

In any case, I think we must take a decision, a way.

Luigi Ferraris

Pritpal Bedi

unread,
Jun 11, 2013, 2:55:08 PM6/11/13
to qtcon...@googlegroups.com, Pritpal Bedi, luigfe...@gmail.com
Hi


I don't know if this IS the only case but probably in the future (or
today) we will have other; ie. today we have  QPrinter:setNumCopies( n )
but this is a deprecated (obsolete) method with Qt 4.8 the new method is
setCopyCount( n ).


After this post I investigated QSound.qth.

This is present in hbqt/qtgui and is compilable with both versions of Qt.
Now I am interested to know why and what problem it is causing to you.

Be noted that our current engine is sufficient enough to distinguish 
between the many versions of Qt and adopt according, so there 
is no need to devise complex builds at all.


Pritpal Bedi
a student of software analysis & concepts
 

Luigi Ferraris

unread,
Jun 12, 2013, 4:09:38 AM6/12/13
to Pritpal Bedi, qtcon...@googlegroups.com
Il 11/06/2013 20.55, Pritpal Bedi ha scritto:
> This is present in hbqt/qtgui and is compilable with both versions of Qt.
> Now I am interested to know why and what problem it is causing to you.
>
> Be noted that our current engine is sufficient enough to distinguish
> between the many versions of Qt and adopt according, so there
> is no need to devise complex builds at all.
>
Hi Pritpal.

I have cleaned my Harbour folder, downloaded new Harbour core.zip and
download new QtContribs. Recompiled everythings without errors (excpet
some - pointed by me - Harbour erros related with
hbmlzo/3rd/minilzo/minilzo.hbp and blat; anyway this is not a problem).

I don't enable anything into qtcontribs.hbp: it is "as is".

I send to you my simple code about QSound usage and related log.

It's very strange because I have my personal library where I have coded
QSound usage with inheritance (ie myObject INHERIT hb_QSound) and THIS
doesn't create any problem when library is compiled, but when I try to
build a program using myObject, it creates the same compiler problems as
you can see in attachement.

Cheers

Luigi

QSound.zip

Pritpal Bedi

unread,
Jun 12, 2013, 4:32:05 AM6/12/13
to qtcon...@googlegroups.com, Pritpal Bedi, luigfe...@gmail.com

#
#
#

-w3
-es2
-n2
-gc2
-strip
-Iinclude

hbqt.hbc
hbqtmultimedia.hbc    //  Needs some tweaks, see below


oop001.prg





hbqtmultimedia.hbc
==============


#
# $Id: hbqtmultimedia.hbc 34 2012-10-13 21:57:41Z bedipritpal $
#

# ---------------------------------------------------------------
# Copyright 2010 Viktor Szakats (harbour syenar.net)
# See COPYING for licensing terms.
# ---------------------------------------------------------------

incpaths=.


libs=../qtcore/hbqtcore.hbc

{!HB_STATIC_QT}libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}

{!HB_STATIC_QT&(HB_QT_MAJOR_VER='4')&(allwin|os2)}libs=QtMultimedia4

{!HB_STATIC_QT&(HB_QT_MAJOR_VER='5')&(allwin|os2)}libs=Qt5Multimedia

{!HB_STATIC_QT&(linux|beos|symbian)}libs=QtMultimedia
{!HB_STATIC_QT&darwin}frameworks=QtMultimedia
{HB_STATIC_QT&allwin}libs=${_HB_DYNPREF}${hb_name}s${_HB_DYNSUFF}
{HB_STATIC_QT&linux|beos}libs=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}
{HB_STATIC_QT&(allwin|linux|beos)}libs=QtMultimedia









Make above changes and then compile the app and let me know.
You need not to compile multimedia librray, only reference to .hbc 
is required. Also ensure that Qt5Multimedia.dll is in the path.


Pritpal Bedi

Luigi Ferraris

unread,
Jun 12, 2013, 4:46:10 AM6/12/13
to Pritpal Bedi, qtcon...@googlegroups.com
Il 12/06/2013 10.32, Pritpal Bedi ha scritto:
> Make above changes and then compile the app and let me know.
> You need not to compile multimedia librray, only reference to .hbc
> is required. Also ensure that Qt5Multimedia.dll is in the path.
>
>
> Pritpal Bedi
I need to rebuild QtContribs (without hbqt multimedia lib) before to use?
Because only with these changes, and current QtContribs libraries
compiled, I receive the same errors.

Luigi

Luigi Ferraris

unread,
Jun 12, 2013, 5:10:23 AM6/12/13
to Pritpal Bedi, qtcon...@googlegroups.com
I have done this other test (using current compiled library, in other
words without recompile QtContribs):
1) I have add line SET HB_QT_MAJOR=5 to my script .bat: nothing changed

2) I have add some lines to hbqtmultimedia.hbc: nothing changed
{!HB_STATIC_QT&(HB_QT_MAJOR_VER='5')&(allwin|os2)}libs=Qt5MultimediaQuick_p
<===
{!HB_STATIC_QT&(HB_QT_MAJOR_VER='5')&(allwin|os2)}libs=Qt5MultimediaWidgets
<===
{!HB_STATIC_QT&(HB_QT_MAJOR_VER='5')&(allwin|os2)}libs=Qt5Multimedia

Luigi

Luigi Ferraris

unread,
Jun 12, 2013, 5:46:58 AM6/12/13
to Pritpal Bedi, qtcon...@googlegroups.com
Il 11/06/2013 20.55, Pritpal Bedi ha scritto:
Be noted that our current engine is sufficient enough to distinguish 
between the many versions of Qt and adopt according, so there 
is no need to devise complex builds at all.

I'm sorry Pritpal... but I'm doing investigations with subject problem and I have discovered other QT4 / QT5 differences...

these lines are copied from current hbqtcore.ch

#define QLibraryInfo_PrefixPath                   0  // The default prefix for all paths.
#define QLibraryInfo_DocumentationPath            1  // The location for documentation upon install.
#define QLibraryInfo_HeadersPath                  2  // The location for all headers.
#define QLibraryInfo_LibrariesPath                3  // The location of installed librarires.
#define QLibraryInfo_BinariesPath                 4  // The location of installed Qt binaries (tools and applications).
#define QLibraryInfo_PluginsPath                  5  // The location of installed Qt plugins.
#define QLibraryInfo_DataPath                     6  // The location of general Qt data.
#define QLibraryInfo_TranslationsPath             7  // The location of translation information for Qt strings.
#define QLibraryInfo_SettingsPath                 8  // The location for Qt settings.
#define QLibraryInfo_ExamplesPath                 10 // The location for examples upon install.
#define QLibraryInfo_DemosPath                    9  // The location for demos upon install.


these lines are copied from qt5 documents about QLybraryInfo

QLibraryInfo::PrefixPath               0    The default prefix for all paths.
QLibraryInfo::DocumentationPath        1    The location for documentation upon install.
QLibraryInfo::HeadersPath              2    The location for all headers.
QLibraryInfo::LibrariesPath            3    The location of installed libraries.
QLibraryInfo::LibraryExecutablesPath   4    The location of installed executables required by libraries at runtime.
QLibraryInfo::BinariesPath             5    The location of installed Qt binaries (tools and applications).
QLibraryInfo::PluginsPath              6    The location of installed Qt plugins.
QLibraryInfo::ImportsPath              7    The location of installed QML extensions to import (QML 1.x).
QLibraryInfo::Qml2ImportsPath          8    The location of installed QML extensions to import (QML 2.x).
QLibraryInfo::ArchDataPath             9    The location of general architecture-dependent Qt data.
QLibraryInfo::DataPath                10    The location of general architecture-independent Qt data.
QLibraryInfo::TranslationsPath        11    The location of translation information for Qt strings.
QLibraryInfo::ExamplesPath            12    The location for examples upon install.
QLibraryInfo::TestsPath               13    The location of installed Qt testcases.
QLibraryInfo::SettingsPath           100    The location for Qt settings. Not applicable on Windows.


I think Digia is not very affordable..... these new values create conflict with previous...... see about 7 in both lines :(


Luigi

Luigi Ferraris

unread,
Jun 12, 2013, 8:11:40 AM6/12/13
to Pritpal Bedi, qtcon...@googlegroups.com
Il 12/06/2013 11.46, Luigi Ferraris ha scritto:
> 'm sorry Pritpal... but I'm doing investigations with subject problem
> and I have discovered other QT4 / QT5 differences...
>
> these lines are copied from current hbqtcore.ch
I try to solve the different defines using #if QT_VERSION < 0x050000
into a prg (only fo test), but I not remember that (#if .... <.... )
can't be used with Harbour/Clipper.
So I don't know how to keep different define aligned.

I'm very embittered. Now, I have to review the use of QT5 and HbQt.

Luigi

Maurizio la Cecilia

unread,
Jun 12, 2013, 11:19:25 AM6/12/13
to qtcon...@googlegroups.com, Pritpal Bedi
Hi Luigi,
the simplest way is to add in your compile settings an environmental variable telling what Qt version you're planning to use.
A subsequent #ifdef QT5 should be enough.

In addition, take a look to addons\hbqt\hbmk2_qt.hb
You'll find the code:

      IF Empty( GetEnv( "HB_QT_MAJOR_VER" ) )              /* To honor Qt 5.0.1 */
         cTmp := qt_version_detect( hbmk, "uic", "UIC_BIN" )
         IF " 5." $ cTmp
            hb_SetEnv( "HB_QT_MAJOR_VER", "5" )
         ELSE
            hb_SetEnv( "HB_QT_MAJOR_VER", "4" )
         ENDIF
      ENDIF

and the needed functions:

STATIC FUNCTION qt_version_detect( hbmk, cName, cEnvQT, lPostfix )

STATIC FUNCTION qt_tool_detect( hbmk, cName, cEnvQT, lPostfix )

I think that this code could be useful to solve the problem, if you think to use a hbmk script.
BR
Maurizio


  


2013/6/12 Luigi Ferraris <luigfe...@gmail.com>


Luigi

--
You received this message because you are subscribed to the Google Groups "QtContribs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qtcontribs+unsubscribe@googlegroups.com.
To post to this group, send email to qtcon...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtcontribs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Luigi Ferraris

unread,
Jun 12, 2013, 11:40:04 AM6/12/13
to qtcon...@googlegroups.com
Il 12/06/2013 17.19, Maurizio la Cecilia ha scritto:
> Hi Luigi,
> the simplest way is to add in your compile settings an environmental
> variable telling what Qt version you're planning to use.
> A subsequent #ifdef QT5 should be enough.
>
> In addition, take a look to addons\hbqt\hbmk2_qt.hb
> You'll find the code:
>
> IF Empty( GetEnv( "HB_QT_MAJOR_VER" ) ) /* To honor Qt 5.0.1 */
> cTmp := qt_version_detect( hbmk, "uic", "UIC_BIN" )
> IF " 5." $ cTmp
> hb_SetEnv( "HB_QT_MAJOR_VER", "5" )
> ELSE
> hb_SetEnv( "HB_QT_MAJOR_VER", "4" )
> ENDIF
> ENDIF
>
> and the needed functions:
>
> STATIC FUNCTION qt_version_detect( hbmk, cName, cEnvQT, lPostfix )
>
> STATIC FUNCTION qt_tool_detect( hbmk, cName, cEnvQT, lPostfix )
>
> I think that this code could be useful to solve the problem, if you
> think to use a hbmk script.
> BR
> Maurizio
Hi Maurizio, many thanks for this idea.... but I think must be
QtContribs to take ownership of these problems in some way to follow its
rules.
I don't have good knowledge to give a robust solutions.
As I write in a previous message, these are signals / evidences of
something that can broke our code. I don't want boring anyone, but take
with care these first "problems".

Cheers

Luigi Ferraris

Luigi Ferraris

unread,
Jun 12, 2013, 11:56:57 AM6/12/13
to qtcon...@googlegroups.com
Il 12/06/2013 17.19, Maurizio la Cecilia ha scritto:
> Hi Luigi,
> the simplest way is to add in your compile settings an environmental
> variable telling what Qt version you're planning to use.
> A subsequent #ifdef QT5 should be enough.
>
> In addition, take a look to addons\hbqt\hbmk2_qt.hb
> You'll find the code:
>
> IF Empty( GetEnv( "HB_QT_MAJOR_VER" ) ) /* To honor Qt 5.0.1 */
> cTmp := qt_version_detect( hbmk, "uic", "UIC_BIN" )
> IF " 5." $ cTmp
> hb_SetEnv( "HB_QT_MAJOR_VER", "5" )
> ELSE
> hb_SetEnv( "HB_QT_MAJOR_VER", "4" )
> ENDIF
> ENDIF
>
> and the needed functions:
>
> STATIC FUNCTION qt_version_detect( hbmk, cName, cEnvQT, lPostfix )
>
> STATIC FUNCTION qt_tool_detect( hbmk, cName, cEnvQT, lPostfix )
>
> I think that this code could be useful to solve the problem, if you
> think to use a hbmk script.
> BR
> Maurizio
On the other hand I see that there are:
HBMK_HAS_QT envar only used by hbmk2? I think yes
HB_QT_MAJOR_VER but this envar seems not required. I receive suggestion:
it's not required to build....
HB_WITH_QT another envar
HB_QTPATH another envar
and QT_VERSION as hexadecimal values
and ....
we must add another define as QT5 ?

I know every of these envars have their reasons to exist, but IMHO we
must have a unique way to check version (I think QT_VERSION must be
preferred) everywhere.

Anyway, my pov is: we must investigate better before use Qt5 as
production.....

Cheers

Luigi Ferraris

Maurizio la Cecilia

unread,
Jun 12, 2013, 2:07:39 PM6/12/13
to Gruppo QtContribs
Hi Luigi,

2013/6/12 Luigi Ferraris <luigfe...@gmail.com>
AFAIR only HB_WITH_QT setting is required to build gtqtc, hbQt, QtContribs, etc., but this variable isn't storing a readable info about version. So I suggested to use a custom one.
If your environment already has a variable useful to decide what version of Qt is installed is a good. But, how to decide if you have (as I have) both Qt4 and Qt5 installed? I need to set it manually, or, as is doing hbmk2, to obtain this info from the system path.
 
I know every of these envars have their reasons to exist, but IMHO we must have a unique way to check version (I think QT_VERSION must be preferred) everywhere.

If you would apply the sample you sent, a #define QT_VERSION=X.X.X won't solve your problem, as it will be impossible to test #if QT_VERSION < 5, apart using a hbmk script.
In Clipper/Harbour preprocessor the only plain way is to set the info in a self contained named variable.
That's because I suggested a #define QT4 or #define QT5 for your needs. This way you'll can do #ifdef QT4 and similar constructs.
About the name it's on you the choice, but the name needs to contain the info.
 

Anyway, my pov is: we must investigate better before use Qt5 as production.....

My doubts are deeper than yours.
Currently I'm still on HwGUI for a lot of reasons, not only about stability... 

Cheers

Luigi Ferraris

Cheers.
Maurizio 

Luigi Ferraris

unread,
Jun 12, 2013, 3:10:25 PM6/12/13
to qtcon...@googlegroups.com
Il 12/06/2013 20.07, Maurizio la Cecilia ha scritto:
On the other hand I see that there are:
HBMK_HAS_QT envar only used by hbmk2? I think yes
HB_QT_MAJOR_VER but this envar seems not required. I receive suggestion: it's not required to build....
HB_WITH_QT another envar
HB_QTPATH another envar
and QT_VERSION as hexadecimal values
and ....
we must add another define as QT5 ?

AFAIR only HB_WITH_QT setting is required to build gtqtc, hbQt, QtContribs, etc., but this variable isn't storing a readable info about version. So I suggested to use a custom one.
If your environment already has a variable useful to decide what version of Qt is installed is a good. But, how to decide if you have (as I have) both Qt4 and Qt5 installed? I need to set it manually, or, as is doing hbmk2, to obtain this info from the system path.
 
I know every of these envars have their reasons to exist, but IMHO we must have a unique way to check version (I think QT_VERSION must be preferred) everywhere.

All things are right... but is not only MY problem or strictly connected with my code... this problem must be solved, in first place, into hbqtcore.ch (or where we need)!!!
So I can't write within this file because must be "as is" on the other hand, anytime I must update this file with my code?
In this situation, to solve MY problem, I will adopt the same as QtContribs... to avoid confusion between my code and QtContribs rules; at least I can create QT5....

If you would apply the sample you sent, a #define QT_VERSION=X.X.X won't solve your problem, as it will be impossible to test #if QT_VERSION < 5, apart using a hbmk script.
In Clipper/Harbour preprocessor the only plain way is to set the info in a self contained named variable.
That's because I suggested a #define QT4 or #define QT5 for your needs. This way you'll can do #ifdef QT4 and similar constructs.
As you can see, there are different include/exclude based upon QT_VERSION: 0x040500, 0x040600, 0x040800, 0x040900, etc.
So, I can't assume that only "5" or "4" can be used...(in previous scenario probably) I want find a better solution: it can be found? it exists? using Harbour/Clipper?

About the name it's on you the choice, but the name needs to contain the info.

To be or not to be: that is the question...

Luigi Ferraris

Francesco Perillo

unread,
Jun 12, 2013, 6:46:30 PM6/12/13
to qtcontribs

It is known that Qt4 IS NOT binary compatible with Qt5 and that everything must be recompiled.

It is known that when recompiling c++ the code will contain the #define string and not 7...

So it's absolutely not a problem at c++. It is a problem for us since hbqt_core.ch is static....

We can:
- create all the #define when we build hbQt. hbmk_qt.hbm should take care to extract c++ defines and create prg defines. Long, and tedious job...
or
- let hbmk_qt.hbm create a small .ch file with just one line: #define QT_VERSION 0x040803. This file should be included as first link in hbqt.ch so that everybody can use this value with #if when we compile user code. hbqt_core.ch can use this define to create the correct one.

I already sent a PM to Pritpal to add a couple of functions to return Qt version to harbour program so that you can, based on version and until a "final" solution is found, redefine all the values.... He replied that he will add them in the next few hours.



For the original problem, the linker needs a class that is not inside any of the libraries. It is now in QtMultimedia and this library must be added to the build process. Pritpal already proposed how to proceed.



Luigi Ferraris

unread,
Jun 13, 2013, 5:35:34 AM6/13/13
to qtcon...@googlegroups.com
Il 13/06/2013 0.46, Francesco Perillo ha scritto:
or
- let hbmk_qt.hbm create a small .ch file with just one line: #define QT_VERSION 0x040803. This file should be included as first link in hbqt.ch so that everybody can use this value with #if when we compile user code. hbqt_core.ch can use this define to create the correct one.
Hi Francesco and everyone.
I read all messages and I understand (more or less) your proposal. About previous, is not clear how can be used. I write a simple .ch example and, please, help me to understand :)

We have hbqtcore.ch with
#define thisIsAnexample    3

One programmer is using QT 4 so this value is right. Another one is using Qt 5, so this value is wrong.
 The new file must be more or less
#if QT_VERSION < 0x050000
    #define thisIsAnexample    3
#else
    #define thisIsAnexample    1000
#endif

AFAIK, the first line can't be compiled by CLIPPER/Harbour; I can only check #if defined QT_VERSION.
How can be intercept and handle this value to setting up right define?
Can be used HbQt_Qt_Version() inside a .ch or .prg ?
This directive must be used at compilation time....

Another way (but is very ... dangerous and tedious) to create file using a copy when hbmk2 is run
IF ???? <= 0x05xxxx
    hbqtcore.ch copied from file hbqtcore.qt4 OR created....
ELSE
    hbqtcore.ch copied from file hbqtcore.qt5 OR created....
ENDIF

Cheers

Luigi Ferraris

Francesco Perillo

unread,
Jun 13, 2013, 5:39:30 AM6/13/13
to qtcon...@googlegroups.com

Harbour can do the #if.      Is not documented but possible

--
You received this message because you are subscribed to the Google Groups "QtContribs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qtcontribs+...@googlegroups.com.

Luigi Ferraris

unread,
Jun 13, 2013, 5:41:01 AM6/13/13
to qtcon...@googlegroups.com
Il 13/06/2013 11.39, Francesco Perillo ha scritto:
> Harbour can do the #if. Is not documented but possible
I have done a test using .prg: can't be compiled. Error.
I read a post by Viktor and he confirms this.... I will try again

Luigi Ferraris

Reply all
Reply to author
Forward
0 new messages