PDA

View Full Version : Compilation of QT Property Browser



yccheok
22nd November 2009, 11:05
Hello all,

I am using QT 4 (the latest GPL version released by Nokia)

I download QT Property Browser from doc.trolltech.com/solutions/4/qtpropertybrowser/index.html

I am using VC++ 2008, with QT Visual Studio Add-In Installed.

I try to build simple project, under qtpropertybrowser solution.

Here is the error message I obtained :



1>------ Rebuild All started: Project: simple, Configuration: Release Win32 ------
1>Deleting intermediate and output files for project 'simple', configuration 'Release|Win32'
1>Moc'ing qtpropertybrowserutils_p.h...
1>RCC ..\..\src\qtpropertybrowser.qrc
1>MOC ..\..\src\qtvariantproperty.h
1>MOC ..\..\src\qtpropertybrowser.h
1>MOC ..\..\src\qtgroupboxpropertybrowser.h
1>MOC ..\..\src\qtbuttonpropertybrowser.h
1>MOC ..\..\src\qttreepropertybrowser.h
1>MOC ..\..\src\qtpropertymanager.h
1>MOC ..\..\src\qteditorfactory.h
1>Compiling...
1>qrc_qtpropertybrowser.cpp
1>qtvariantproperty.cpp
1>qttreepropertybrowser.cpp
1>..\..\src\qttreepropertybrowser.cpp(1091) : fatal error C1083: Cannot open include file: 'qttreepropertybrowser.moc': No such file or directory
1>qtpropertymanager.cpp
1>..\..\src\qtpropertymanager.cpp(6470) : fatal error C1083: Cannot open include file: 'qtpropertymanager.moc': No such file or directory
1>qtpropertybrowserutils.cpp
1>qtpropertybrowser.cpp
1>qtgroupboxpropertybrowser.cpp
1>qteditorfactory.cpp
1>..\..\src\qteditorfactory.cpp(2592) : fatal error C1083: Cannot open include file: 'qteditorfactory.moc': No such file or directory
1>qtbuttonpropertybrowser.cpp
1>main.cpp
1>Generating Code...
1>Build log was saved at "file://c:\Documents and Settings\yan-cheng.cheok\Desktop\qtpropertybrowser-2.5-opensource\qtpropertybrowser-2.5-opensource\examples\simple\release\BuildLog.htm"
1>simple - 3 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========


Any suggestion to pass the compilation will be very much appreciated.

yccheok
22nd November 2009, 13:15
OK. Finally I figure out the workaround, I need to manually run the following command before clicking on the build all button.


moc qttreepropertybrowser > qttreepropertybrowser.moc
moc qtpropertymanager > qtpropertymanager.moc
moc qteditorfactory > qteditorfactory.moc

Not sure why. QT people should include these command in their build file :(

DaesDemon
31st December 2009, 15:13
I confirm there is a problem with the buildlib pro of the 2.5.1 file imported in VisualStudio VS2005 at least with QT 4.6
- No import library created
- No export in the library ( dll_export not defined )
- Error message importing the pro file ( see ScreenShot attachment) with the last VS Addin

I suceeded in compiling it without a problem with :


cd buillib
qmake
nmake


but now i get some strange linking problems:

I have a class derived from QtPropertyBrowser


class PropertyEditor : public QtTreePropertyBrowser
{
Q_OBJECT
public:
PropertyEditor(QWidget *parent=0);
~PropertyEditor();

void setObject(QObject* object);
public slots:
void updateObjectProperty(QtProperty * property, const QVariant & value);

private:
QObject* _object;
QtVariantPropertyManager _manager;
QtVariantEditorFactory _factory;
};


I get unresolved symbol in linking:

public: static struct QMetaObject const QtTreePropertyBrowser::staticMetaObject" (?staticMetaObject@QtTreePropertyBrowser@@2UQMetaO bject@@B)


Do someone have an idea about what could cause this kind of problem?

I didn't have those problems with QT 4.5 and QtPropertyBrowser 2.5

nitro3
8th March 2010, 20:29
Ok, if anyone is still having problems, here is what worked for me ( after a day of beating my head against the computer ).
Before opening the qtpropertybrowser.pro with VS2008
cd to qtpropertybrowser dir using the VS2008 cmd then run
>configure -library
exit cmd,
now open qtpropertybrowser.pro with VS and it should now open buildlib.pro properly as QtSolution_qtpropertybrowser_2.5.vsproject
NOW... go to QtSolution_qtpropertybrowser's property window and browse to C/C++ -> Preprocessor
there you should notice an entry called QT_QTPROPERTYBROWSER_IMPORT
change that to QT_QTPROPERTYBROWSER_EXPORT ( that is the main culprit )
and walla all of a sudden it compiles and no more missing *.moc files and inconsistent dll linkage warnings

stefanadelbert
29th March 2010, 00:16
I still get the problem with the unfound *.moc files, even after changing to using QT_QTPROPERTYBROWSER_EXPORT. If I manually create just one of the MOC files using

C:\Qt\4.6.2\bin\moc.exe .\qttreepropertybrowser.h > qttreepropertybrowser.moc
and rebuild I start getting a number of other errors (see otuput below). You will notice that there are still two MOC files missing, as expected. If I manually MOC those two remaining missing files I get literally hundreds of similar build errors.

I'm using Qt 4.6.2, QtPropertyBrowser 2.5.1, Windows 7, VS 2008. If anyone has seen these errors and have managed to get them sorted out, please let me know.

Thanks
Stefan

1>------ Build started: Project: QtSolutions_PropertyBrowser-2.5, Configuration: Debug Win32 ------
1>Compiling...
1>qttreepropertybrowser.cpp
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(20) : error C2370: 'qt_meta_data_QtTreePropertyBrowser' : redefinition; different storage class
1> c:\Users\Stefan Adelbert\Documents\dev\iteration1\3rdParty\qtprope rtybrowser-2.5_1-opensource\buildlib\debug\moc_qttreepropertybrowse r.cpp(20) : see declaration of 'qt_meta_data_QtTreePropertyBrowser'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(64) : error C2370: 'qt_meta_stringdata_QtTreePropertyBrowser' : redefinition; different storage class
1> c:\Users\Stefan Adelbert\Documents\dev\iteration1\3rdParty\qtprope rtybrowser-2.5_1-opensource\buildlib\debug\moc_qttreepropertybrowse r.cpp(64) : see declaration of 'qt_meta_stringdata_QtTreePropertyBrowser'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(79) : error C2374: 'staticMetaObject' : redefinition; multiple initialization
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(62) : see declaration of 'staticMetaObject'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(89) : error C2084: function 'const QMetaObject *QtTreePropertyBrowser::metaObject(void) const' already has a body
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(62) : see previous definition of 'metaObject'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(94) : error C2084: function 'void *QtTreePropertyBrowser::qt_metacast(const char *)' already has a body
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(62) : see previous definition of 'qt_metacast'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(102) : error C2084: function 'int QtTreePropertyBrowser::qt_metacall(QMetaObject::Ca ll,int,void **)' already has a body
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(62) : see previous definition of 'qt_metacall'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(162) : error C2084: function 'void QtTreePropertyBrowser::collapsed(QtBrowserItem *)' already has a body
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(119) : see previous definition of 'collapsed'
1>c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\qttreepropertybrowser.moc(169) : error C2084: function 'void QtTreePropertyBrowser::expanded(QtBrowserItem *)' already has a body
1> c:\users\stefan adelbert\documents\dev\iteration1\3rdparty\qtprope rtybrowser-2.5_1-opensource\src\.\qttreepropertybrowser.h(120) : see previous definition of 'expanded'
1>qtpropertymanager.cpp
1>..\src\qtpropertymanager.cpp(6430) : fatal error C1083: Cannot open include file: 'qtpropertymanager.moc': No such file or directory
1>qteditorfactory.cpp
1>..\src\qteditorfactory.cpp(2552) : fatal error C1083: Cannot open include file: 'qteditorfactory.moc': No such file or directory
1>Generating Code...
1>Build log was saved at "file://c:\Users\Stefan Adelbert\Documents\dev\iteration1\3rdParty\qtprope rtybrowser-2.5_1-opensource\buildlib\debug\BuildLog.htm"
1>QtSolutions_PropertyBrowser-2.5 - 10 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

stefanadelbert
29th March 2010, 01:35
If I attempt to load just buildlib.pro into VS2008, after running configure.bat on a freshly extracted qtpropertybrowser 2.5.1, I get the following error: ..."Cannot add moc step to file..." (see attached screenshot).

This is the import output:

--- (Import): Generating new project of buildlib.pro file
--- (qmake) : Using: c:\qt\4.6.2\bin\qmake
--- (qmake) : Working Directory: C:\Qt\qtpropertybrowser-2.5_1-opensource\buildlib
--- (qmake) : Arguments: -spec $(QTDIR)\mkspecs\win32-msvc2008 -tp vc "buildlib.pro" -o "buildlib.vcproj" QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR_QT= QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_UIC=$(QTDIR)\bin\uic.exe QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_RCC=$(QTDIR)\bin\rcc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe

--- (qmake) : Exit Code: 0

--- (Import): Added buildlib.vcproj to Solution


When I atempt to build the project I (obviously) get the following error in the buid output:

1>------ Build started: Project: QtSolutions_PropertyBrowser-2.5, Configuration: Debug Win32 ------
1>Compiling...
1>qrc_qtpropertybrowser.cpp
1>moc_qtpropertybrowserutils_p.cpp
1>qtvariantproperty.cpp
1>qttreepropertybrowser.cpp
1>qtpropertymanager.cpp
1>qtpropertybrowserutils.cpp
1>qtpropertybrowser.cpp
1>qtgroupboxpropertybrowser.cpp
1>qteditorfactory.cpp
1>..\src\qteditorfactory.cpp(2552) : fatal error C1083: Cannot open include file: 'qteditorfactory.moc': No such file or directory
1>qtbuttonpropertybrowser.cpp
1>Generating Code...
1>Build log was saved at "file://c:\Qt\qtpropertybrowser-2.5_1-opensource\buildlib\debug\BuildLog.htm"
1>QtSolutions_PropertyBrowser-2.5 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

stefanadelbert
29th March 2010, 01:58
I managed to get QtPropertyBrowser building, but I had to manually edit the "Generated Files" section of the vcproj file that was created by the Qt VS plugin to remove a bogus "Debug" filter and add a build directive for "qteditfactory.moc".

I added the following to buildlib.vcproj:


<File
RelativePath="debug\qteditorfactory.moc"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC ..\src\qteditorfactory.cpp"
CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debugqteditorfactory.moc&#x0D;&#x0A;&quot;$(QTDIR)\bin\moc.exe&quot; -D_WINDOWS -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_QTPROPERTYBROWSER_EXPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -D_WINDLL -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\..\src\.&quot; -I&quot;$(QTDIR)\include\ActiveQt\.&quot; -I&quot;.\debug\.&quot; -I&quot;$(QTDIR)\mkspecs\win32-msvc2008\.&quot; &quot;..\src\qteditorfactory.cpp&quot; -o &quot;debug\qteditorfactory.moc&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\qteditorfactory.cpp;Rem"
Outputs="debug\qteditorfactory.moc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="MOC ..\src\qteditorfactory.cpp"
CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile releaseqteditorfactory.moc&#x0D;&#x0A;&quot;$(QTDIR)\bin\moc.exe&quot; -DQT_NO_DEBUG -DNDEBUG -D_WINDOWS -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_QTPROPERTYBROWSER_IMPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DNDEBUG -D_WINDLL -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\.&quot; -I&quot;.\..\src\.&quot; -I&quot;$(QTDIR)\include\ActiveQt\.&quot; -I&quot;.\release\.&quot; -I&quot;$(QTDIR)\mkspecs\win32-msvc2008\.&quot; &quot;..\src\qteditorfactory.cpp&quot; -o &quot;release\qteditorfactory.moc&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\qteditorfactory.cpp;Rem"
Outputs="release\qteditorfactory.moc"
/>
</FileConfiguration>
</File>

I am now able to get a debug and release build of QtPropertyBrowser 2.5.1 using Qt 4.6.2 on Window 7. I believe that the problem here is a bug with the Qt VS plugin. Anyone care to comment on that?

stefanadelbert
29th July 2010, 00:39
I use static versions of this QtPropertyBrowser library because I get linker errors when attempting to use DLL's - something about staticMetaObject.

These are the steps that I follow on Windows 7, Visual Studio 2008, Qt 4.6.3:


Unpack the Files from the archive (qtpropertybrowser-2.5_1-opensource.zip (http://get.qt.nokia.com/qt/solutions/lgpl/qtpropertybrowser-2.5_1-opensource.zip))
Change to the qtpropertybrowser-2.5_1-opensource directory
Run the configure script (configure.bat): configure -library
Run qmake: $(QTDIR)\bin.qmake.exe
Manually run moc.exe on:

qteditorfactory.h
qtpropertymanager.h
qttreebrowser.h

Copy moc files to intermediate directories (Debug, Release)
Open qtpropertybrowser.pro with Visual Studio Qt plugin
Change the Configuration Type for both Debug and Release to Static Library (.lib)
Change the Output Directory and the Intermediate Directory to $(ConfigurationName)
For Release and Debug modes, change QT_QTPROPERTYBROWSER_IMPORT to QT_QTPROPERTYBROWSER_EXPORT for C++ >> Preprocessor >> Preprocessor Definitions
Remove Post-Build Event which will attempt to copy a .dll to $(QTDIR)\bin
Build Debug and Release libraries


Once the libraries have been built they will be located at ...\qtpropertybrowser-2.5_1-opensource\buildlib\[Debug\Release]. Other libraries that link against them should refer to them there.

With this set of steps I don't get any of the compiler or linker errors mentioned above.