Alles rund um die Programmierung mit Qt
Walsi
Beiträge: 6 Registriert: 26. März 2007 22:25
Beitrag
von Walsi » 11. April 2007 16:01
Hello, ...
I want to create a SIP Client Application using Qt4 for the User Interface. My developing is really at the beginning and I got a problem with the makefile. My SIP Client GUI is based on a OpenSource SIP Stack (pjsip.org). On this Homepage is a Manual which explains how to create a own SIP Client GUI. They say, that I have to write my own makefile which involves following lines.
Code: Alles auswählen
#Modify this to point to the PJSIP location.
PJBASE=/home/myself/pjproject-0.5.10.2
include $(PJBASE)/build.mak
CC = $(APP_CC)
LDFLAGS = $(APP_LDFLAGS)
LDLIBS = $(APP_LDLIBS)
CFLAGS = $(APP_CFLAGS)
CPPFLAGS= ${CFLAGS}
# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: myapp
myapp: myapp.cpp
$(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)
clean:
rm -f myapp.o myapp
But also the command
generates his own makefiles which involve the path for the Qt4 include files.
So when I use the the makefile generated by qmake, the compiler doesn't find the includes from the pjsip.
So my Question: How can or must I combine or build the makefile that i can make a successful build of my program.
Best Regards,...
Walsi
Beiträge: 6 Registriert: 26. März 2007 22:25
Beitrag
von Walsi » 12. April 2007 09:01
Okay, I try it another way:
This is my makefile generated by qmake:
Code: Alles auswählen
-#############################################################################
# Makefile for building: usc-es_0-1
# Generated by qmake (2.01a) (Qt 4.2.3) on: Thu Apr 12 08:32:45 2007
# Project: usc-es_0-1.pro
# Template: app
# Command: /usr/local/Trolltech/Qt-4.2.3/bin/qmake -unix -o Makefile usc-es_0-1.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
LEXFLAGS =
YACCFLAGS = -d
INCPATH = -I/usr/local/Trolltech/Qt-4.2.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.2.3/include/QtCore -I/usr/local/Trolltech/Qt-4.2.3/include/QtCore -I/usr/local/Trolltech/Qt-4.2.3/include/QtGui -I/usr/local/Trolltech/Qt-4.2.3/include/QtGui -I/usr/local/Trolltech/Qt-4.2.3/include -I. -Isrc -I. -I.
LINK = g++
LFLAGS = -Wl,-rpath,/usr/local/Trolltech/Qt-4.2.3/lib
LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.2.3/lib -lQtGui -L/home/nb100146/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -ldl -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/local/Trolltech/Qt-4.2.3/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = src/uscgui.cpp \
src/uscinterface.cpp moc_uscgui.cpp
OBJECTS = uscgui.o \
uscinterface.o \
moc_uscgui.o
DIST = /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf \
usc-es_0-1.pro
QMAKE_TARGET = usc-es_0-1
DESTDIR =
TARGET = usc-es_0-1
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: usc-es_0-1.pro /usr/local/Trolltech/Qt-4.2.3/mkspecs/linux-g++/qmake.conf /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf \
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf \
/usr/local/Trolltech/Qt-4.2.3/lib/libQtGui.prl \
/usr/local/Trolltech/Qt-4.2.3/lib/libQtCore.prl
$(QMAKE) -unix -o Makefile usc-es_0-1.pro
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf:
/usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf:
/usr/local/Trolltech/Qt-4.2.3/lib/libQtGui.prl:
/usr/local/Trolltech/Qt-4.2.3/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -unix -o Makefile usc-es_0-1.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/usc-es_0-11.0.0 || $(MKDIR) .tmp/usc-es_0-11.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/usc-es_0-11.0.0/ && $(COPY_FILE) --parents src/uscgui.h .tmp/usc-es_0-11.0.0/ && $(COPY_FILE) --parents src/uscgui.cpp src/uscinterface.cpp .tmp/usc-es_0-11.0.0/ && (cd `dirname .tmp/usc-es_0-11.0.0` && $(TAR) usc-es_0-11.0.0.tar usc-es_0-11.0.0 && $(COMPRESS) usc-es_0-11.0.0.tar) && $(MOVE) `dirname .tmp/usc-es_0-11.0.0`/usc-es_0-11.0.0.tar.gz . && $(DEL_FILE) -r .tmp/usc-es_0-11.0.0
yaccclean:
lexclean:
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
/usr/local/Trolltech/Qt-4.2.3/bin/moc:
(cd $(QTDIR)/src/tools/moc && $(MAKE))
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_uscgui.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_uscgui.cpp
moc_uscgui.cpp: src/uscgui.h \
/usr/local/Trolltech/Qt-4.2.3/bin/moc
/usr/local/Trolltech/Qt-4.2.3/bin/moc $(DEFINES) $(INCPATH) src/uscgui.h -o moc_uscgui.cpp
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean
####### Compile
uscgui.o: src/uscgui.cpp src/uscgui.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o uscgui.o src/uscgui.cpp
uscinterface.o: src/uscinterface.cpp src/uscgui.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o uscinterface.o src/uscinterface.cpp
moc_uscgui.o: moc_uscgui.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_uscgui.o moc_uscgui.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
I have to include in this makefile some other lines, because I want to build a application which is based on the sources of the pjproject sources. In a manual of pjproject is written that my makefile have to look like this:
Code: Alles auswählen
#Modify this to point to the PJSIP location.
PJBASE=/home/myself/pjproject-0.5.10.2
include $(PJBASE)/build.mak
CC = $(APP_CC)
LDFLAGS = $(APP_LDFLAGS)
LDLIBS = $(APP_LDLIBS)
CFLAGS = $(APP_CFLAGS)
CPPFLAGS= ${CFLAGS}
# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: myapp
myapp: myapp.cpp
$(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)
clean:
rm -f myapp.o myapp
My question: How can I include this few lines to the Qt specific makefile that the make also finds the pjproject sources????
Best Regards,...
Christian81
Beiträge: 7319 Registriert: 26. August 2004 14:11
Wohnort: Bremen
Kontaktdaten:
Beitrag
von Christian81 » 12. April 2007 09:06
qmake does not support this in an easy way. There are some hacks where it is possible, but in general you can't mix custom Makefiles with qmake / cmake generated ones.
MfG Christian
'Funktioniert nicht' ist keine Fehlerbeschreibung
Walsi
Beiträge: 6 Registriert: 26. März 2007 22:25
Beitrag
von Walsi » 12. April 2007 14:14
And how can I handle / solve my problem?
How can I build my application?
Walsi
Beiträge: 6 Registriert: 26. März 2007 22:25
Beitrag
von Walsi » 12. April 2007 16:14
Hey, Christian81
Thanks for your information. But just yet I find out how to handle my problem. qmake also generates me a .pro file before it generates me the Makefile. The .pro file is much easier to understand and to configure by a "human being".
So today I find out how to fill up this .pro file correctly with the PSJIP specific Includes and Libraries.
My Profile looks like this at the moment:
Code: Alles auswählen
######################################################################
# Automatically generated by qmake (2.01a) Thu Apr 12 15:03:47 2007
######################################################################
TEMPLATE = app
TARGET =
DEPENDPATH += . src
INCLUDEPATH += . src
LIBS += -L/home/user/pjproject-0.5.10.2/pjlib/lib
LIBS += -L/home/user/pjproject-0.5.10.2/pjlib-util/lib/
LIBS += -L/home/user/pjproject-0.5.10.2/pjmedia/lib
LIBS += -L/home/user/pjproject-0.5.10.2/pjsip/lib
LIBS += -lpjsua-i686-pc-linux-gnu
LIBS += -lpjsip-ua-i686-pc-linux-gnu
LIBS += -lpjsip-simple-i686-pc-linux-gnu
LIBS += -lpjsip-i686-pc-linux-gnu
LIBS += -lpjmedia-codec-i686-pc-linux-gnu
LIBS += -lpjmedia-i686-pc-linux-gnu
LIBS += -lpjmedia-codec-i686-pc-linux-gnu
LIBS += -lpjlib-util-i686-pc-linux-gnu
LIBS += -lpj-i686-pc-linux-gnu
LIBS += -lm -lnsl -lrt -lpthread
INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjlib/include
INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjlib-util/include
INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjmedia/include
INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjsip/include
# Input
HEADERS += src/uscgui.h
SOURCES += src/uscgui.cpp src/uscinterface.cpp
And it works with this configuration.
Thanks for your help!
Best Regards,...