PDA

View Full Version : QAssistantClient on Mac OS X



fahlen
28th November 2007, 08:16
Hi. I am currently using QAssistantClient on Windows and Linux as a help tool for my application. However, when I try to compile on Mac with XCode, I get the following errors:


error: QAssistantClient: No such file or directory
error: invalid use of undefined type 'struct QAssistantClient'
error: forward declaration of 'struct QAssistantClient'

I have installed qt-mac-opensource-4.3.2.dmg and when I comment the code related to QAssistantClient, the applications compiles and links just fine.

In the project file I have added "CONFIG += assistant" as one is supposed to. Also, doing a "find /Library/Frameworks -name qassistantclient*" on Mac, it appears the header files are installed:

/Library/Frameworks/QtAssistant.framework/Versions/4/Headers/qassistantclient.h
/Library/Frameworks/QtAssistant.framework/Versions/4/Headers/qassistantclient_global.h

Is there anything else I need to specify in the project file other than "CONFIG += assistant" in order to make the compilation work on Mac?

I'm grateful for any suggestions I can get.

fahlen
28th November 2007, 08:51
For some reason QtAssistant.framework doesn't get added to the .xcodeproj file. I have compared the .pro files of the Qt example "simpletextviewer" and my application to find out why, but I don't see any important difference.

This is simpletextviewer.pro

CONFIG += assistant

QT += network

HEADERS = mainwindow.h \
findfiledialog.h
SOURCES = main.cpp \
mainwindow.cpp \
findfiledialog.cpp

# install
target.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer
sources.files = $$SOURCES $$HEADERS $$RESOURCES documentation *.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer
INSTALLS += target sources

And this is my applications .pro file:

TEMPLATE = app
TARGET = CotigEditorQt
CONFIG += qt \
warn_on \
release \
console \
static \
assistant
QT += network
HEADERS += suggestiondialog.h \
qbmtextedit.h \
encodingvalidator.h \
optionsdialog.h \
cotigeditor.h \
aboutdialog.h \
helpdialog.h \
printpreview.h \
searchdialog.h \
spellcheckdialog.h
SOURCES += suggestiondialog.cpp \
qbmtextedit.cpp \
encodingvalidator.cpp \
optionsdialog.cpp \
main.cpp \
cotigeditor.cpp \
aboutdialog.cpp \
helpdialog.cpp \
printpreview.cpp \
searchdialog.cpp \
spellcheckdialog.cpp
FORMS += suggestiondialog.ui \
optionsdialog.ui \
aboutdialog.ui \
helpdialog.ui \
searchdialog.ui \
spellcheckdialog.ui
RESOURCES += CotigEditorQt.qrc
TRANSLATIONS = translations/CotigEditorQt_ca.ts
INCLUDEPATH += ../CotigMainProxyQt
!macx:unix {
message("Building for Linux.")
LIBS += -L../CotigMainProxyQt \
-lCotigMainProxyQt
}
macx {
message("Building for Mac.")
LIBS += -L../CotigMainProxyQt \
-lCotigMainProxyQt
QMAKE_INFO_PLIST = mac/Info.plist
RC_FILE = mac/CotigEditorQt.icns
localizations.files = mac/locversion.plist
localizations.path = Contents/Resources
QMAKE_BUNDLE_DATA += localizations
}
win32 {
message("Building for Windows.")
LIBS += -L../CotigMainProxyQt/release \
-lCotigMainProxyQt
}

fahlen
7th December 2007, 09:14
I just wanted to post and say that my problem has been solved, although the solution isn't a very pretty one. If someone knows of a better way, please let me know.

I have dropped XCode altogether, as I'm more accustomed to work with g++. I execute "qmake -spec macx-g++" to obtain the makefile for the project.

I then edit the makefile and add "-I/Library/Frameworks/QtAssistant.framework/Versions/4/Headers" to the INCPATH.

Then finally, I change "-framework QtAssistantClient" to "-framework QtAssistant" for LIBS in the makefile, as there is no framework called QtAssistantClient.

Now everything builds just fine. However, it's a pain having to hand edit the makefile everytime it has been recreated.

Does anyone know of a better way?

I'm now using Qt 4.3.3, and it has been installed from the .dmg.