Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, March 2002
compile error ( inheritance problem ? )


Message 1 in thread

Hi,

I'm using Qt3.0.2 on Linux ( Suse 7.2 )

With designer ( .ui ) , I'm making a QMainWindow derived class : MainFrame 
I also have a class exoTKADMainFrame inheriting from MainFrame

When I try to compile, I have the following errors :

.obj/exoTKADMainFrame.o: In function 
`exoTKADMainFrame::exoTKADMainFrame(void)':
.obj/exoTKADMainFrame.o(.text+0x1f): undefined reference to 
`exoTKADMainFrame::QPaintDevice virtual table'
.obj/exoTKADMainFrame.o(.text+0x26): undefined reference to `exoTKADMainFrame 
virtual table'
.obj/exoTKADMainFrame.o: In function 
`exoTKADMainFrame::~exoTKADMainFrame(void)':
.obj/exoTKADMainFrame.o(.text+0x4f): undefined reference to 
`exoTKADMainFrame::QPaintDevice virtual table'
.obj/exoTKADMainFrame.o(.text+0x56): undefined reference to `exoTKADMainFrame 
virtual table'


What does that mean ?
What should I do to solve these errors ?

TIA,

Stephane
http://www.exotk.org

PS : sorry, I'm quite a newbie in programming with Linux and Qt


Message 2 in thread

Make sure you are also linking the .moc.o files, this is likely your problem. 
 If that isn't the case, ensure that you are linking Qt 3 and not Qt 2.x.

On Monday 18 March 2002 2:18 pm, Stephane Routelous wrote:
> Hi,
>
> I'm using Qt3.0.2 on Linux ( Suse 7.2 )
>
> With designer ( .ui ) , I'm making a QMainWindow derived class : MainFrame
> I also have a class exoTKADMainFrame inheriting from MainFrame
>
> When I try to compile, I have the following errors :
>
> .obj/exoTKADMainFrame.o: In function
> `exoTKADMainFrame::exoTKADMainFrame(void)':
> .obj/exoTKADMainFrame.o(.text+0x1f): undefined reference to
> `exoTKADMainFrame::QPaintDevice virtual table'
> .obj/exoTKADMainFrame.o(.text+0x26): undefined reference to
> `exoTKADMainFrame virtual table'
> .obj/exoTKADMainFrame.o: In function
> `exoTKADMainFrame::~exoTKADMainFrame(void)':
> .obj/exoTKADMainFrame.o(.text+0x4f): undefined reference to
> `exoTKADMainFrame::QPaintDevice virtual table'
> .obj/exoTKADMainFrame.o(.text+0x56): undefined reference to
> `exoTKADMainFrame virtual table'
>
>
> What does that mean ?
> What should I do to solve these errors ?
>
> TIA,
>
> Stephane
> http://www.exotk.org
>
> PS : sorry, I'm quite a newbie in programming with Linux and Qt


Message 3 in thread

Hi,

I don't understand : I don't have moc files for this class.
I'm using qmake.
When I run the generated Makefile, I have 
Makefile:176: warning: overriding commands for target `.moc'
Makefile:173: warning: ignoring old commands for target `.moc'

Should not qmake generate the moc classes automatically ?

I attach the .pro and the Makefile, if it can help

TIA,

Stephane
http://www.exotk.org


On March 18, 2002 16:23, Christopher Thompson wrote:
> Make sure you are also linking the .moc.o files, this is likely your
> problem. If that isn't the case, ensure that you are linking Qt 3 and not
> Qt 2.x.
>
> On Monday 18 March 2002 2:18 pm, Stephane Routelous wrote:
> > Hi,
> >
> > I'm using Qt3.0.2 on Linux ( Suse 7.2 )
> >
> > With designer ( .ui ) , I'm making a QMainWindow derived class :
> > MainFrame I also have a class exoTKADMainFrame inheriting from MainFrame
> >
> > When I try to compile, I have the following errors :
> >
> > .obj/exoTKADMainFrame.o: In function
> > `exoTKADMainFrame::exoTKADMainFrame(void)':
> > .obj/exoTKADMainFrame.o(.text+0x1f): undefined reference to
> > `exoTKADMainFrame::QPaintDevice virtual table'
> > .obj/exoTKADMainFrame.o(.text+0x26): undefined reference to
> > `exoTKADMainFrame virtual table'
> > .obj/exoTKADMainFrame.o: In function
> > `exoTKADMainFrame::~exoTKADMainFrame(void)':
> > .obj/exoTKADMainFrame.o(.text+0x4f): undefined reference to
> > `exoTKADMainFrame::QPaintDevice virtual table'
> > .obj/exoTKADMainFrame.o(.text+0x56): undefined reference to
> > `exoTKADMainFrame virtual table'
> >
> >
> > What does that mean ?
> > What should I do to solve these errors ?
> >
> > TIA,
> >
> > Stephane
> > http://www.exotk.org
> >
> > PS : sorry, I'm quite a newbie in programming with Linux and Qt
#############################################################################
# Makefile for building: exoTKAD
# Generated by qmake (1.02a) on: Mon Mar 18 16:42:24 2002
# Project:  exoTKAD.pro
# Template: app
# Command: $(QMAKE) exoTKAD.pro
#############################################################################

####### Compiler, tools and options

CC       = gcc
CXX      = g++
LEX      = flex
YACC     = yacc
CFLAGS   = -pipe -Wall -W -O2 -D_REENTRANT  -DLIN -DQT_NO_DEBUG -DQT_NO_CHECK -DQT_THREAD_SUPPORT
CXXFLAGS = -pipe -Wall -W -O2 -D_REENTRANT  -DLIN -DQT_NO_DEBUG -DQT_NO_CHECK -DQT_THREAD_SUPPORT
LEXFLAGS = 
YACCFLAGS= -d
INCPATH  = -I${CASROOT}/inc -I${EXOTKROOT}/inc -I$(QTDIR)/include -I.ui/ -I/home/sroutelous/exoTKAD/Qt/exoTKAD -I.moc/ -I$(QTDIR)/mkspecs/linux-g++
LINK     = g++
LFLAGS   = 
LIBS     = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt-mt -lpthread -L$(CASROOT)/Linux/lib -lTKernel -lexoTK -L$(EXOTKROOT)/lin/lib -lTKMath -lTKService -lTKG2d -lTKBRep -lTKG3d -lTKGeomBase -lTKV3d -lTKBool -lTKTopAlgo -lTKGeomAlgo -lTKFillet -lTKV2d -lTKPrim -lTKHLR -lXext -lX11 -lm
AR       = ar cqs
RANLIB   = 
MOC      = $(QTDIR)/bin/moc
UIC      = $(QTDIR)/bin/uic
QMAKE    = qmake
TAR      = tar -cf
GZIP     = gzip -9f
COPY     = cp -f
COPY_FILE= $(COPY) -p
COPY_DIR = $(COPY) -pR
DEL_FILE = rm -f
DEL_DIR  = rmdir
MOVE     = mv

####### Output directory

OBJECTS_DIR = .obj/

####### Files

HEADERS = Document.hxx \
		exoTKADMainFrame.hxx \
		exoTKADChildFrame.hxx
SOURCES = Document.cxx \
		exoTKADMainFrame.cxx \
		exoTKADChildFrame.cxx
OBJECTS = .obj/Document.o \
		.obj/exoTKADMainFrame.o \
		.obj/exoTKADChildFrame.o \
		.obj/childframe.o \
		.obj/mainframe.o \
		.obj/qmake_image_collection.o
FORMS = childframe.ui \
		mainframe.ui
UICDECLS = .ui/childframe.h \
		.ui/mainframe.h
UICIMPLS = .ui/childframe.cpp \
		.ui/mainframe.cpp
SRCMOC   = .moc/moc_childframe.cpp \
		.moc/moc_mainframe.cpp
OBJMOC = .obj/moc_childframe.o \
		.obj/moc_mainframe.o
DIST	   = 
QMAKE_TARGET = exoTKAD
DESTDIR  = 
TARGET   = exoTKAD

first: all
####### Implicit rules

.SUFFIXES: .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): $(UICDECLS) $(OBJECTS) $(OBJMOC) 
	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)

mocables: $(SRCMOC)

$(MOC): 
	( cd $(QTDIR)/src/moc ; $(MAKE) )

Makefile: exoTKAD.pro  
	$(QMAKE) exoTKAD.pro
qmake: 
	@$(QMAKE) exoTKAD.pro

dist: 
	@mkdir -p .obj/exoTKAD && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .obj/exoTKAD/ && ( cd `dirname .obj/exoTKAD` && $(TAR) exoTKAD.tar exoTKAD && $(GZIP) exoTKAD.tar ) && mv `dirname .obj/exoTKAD`/exoTKAD.tar.gz . && rm -rf .obj/exoTKAD

mocclean:
	-rm -f $(OBJMOC)
	-rm -f $(SRCMOC)

uiclean:
	-rm -f $(UICIMPLS) $(UICDECLS)

clean: mocclean uiclean
	-rm -f $(OBJECTS) 
		-rm -f .ui/qmake_image_collection.cpp
	-rm -f *~ core *.core


####### Sub-libraries

distclean: clean
	-rm -f $(TARGET) $(TARGET)
	

FORCE:

####### Compile

.obj/Document.o: Document.cxx Document.hxx \
		exoTKADChildFrame.hxx \
		exoTKADMainFrame.hxx \
		.ui/childframe.h \
		.ui/mainframe.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/Document.o Document.cxx

.obj/exoTKADMainFrame.o: exoTKADMainFrame.cxx exoTKADMainFrame.hxx \
		.ui/mainframe.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/exoTKADMainFrame.o exoTKADMainFrame.cxx

.obj/exoTKADChildFrame.o: exoTKADChildFrame.cxx exoTKADChildFrame.hxx \
		.ui/childframe.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/exoTKADChildFrame.o exoTKADChildFrame.cxx

.ui/childframe.h: childframe.ui childframe.ui.h
	$(UIC) childframe.ui -o .ui/childframe.h

.ui/childframe.cpp: .ui/childframe.h childframe.ui childframe.ui.h
	$(UIC) childframe.ui -i childframe.h -o .ui/childframe.cpp

.ui/mainframe.h: mainframe.ui mainframe.ui.h
	$(UIC) mainframe.ui -o .ui/mainframe.h

.ui/mainframe.cpp: .ui/mainframe.h mainframe.ui mainframe.ui.h
	$(UIC) mainframe.ui -i mainframe.h -o .ui/mainframe.cpp

.obj/childframe.o: .ui/childframe.cpp .ui/childframe.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/childframe.o .ui/childframe.cpp

.obj/mainframe.o: .ui/mainframe.cpp .ui/mainframe.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/mainframe.o .ui/mainframe.cpp

.obj/moc_childframe.o: .moc/moc_childframe.cpp .ui/childframe.h 
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_childframe.o .moc/moc_childframe.cpp

.obj/moc_mainframe.o: .moc/moc_mainframe.cpp .ui/mainframe.h 
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/moc_mainframe.o .moc/moc_mainframe.cpp

.moc: $(MOC) Document.hxx
	$(MOC) Document.hxx -o .moc

.moc: $(MOC) exoTKADMainFrame.hxx
	$(MOC) exoTKADMainFrame.hxx -o .moc

.moc: $(MOC) exoTKADChildFrame.hxx
	$(MOC) exoTKADChildFrame.hxx -o .moc

.moc/moc_childframe.cpp: $(MOC) .ui/childframe.h
	$(MOC) .ui/childframe.h -o .moc/moc_childframe.cpp

.moc/moc_mainframe.cpp: $(MOC) .ui/mainframe.h
	$(MOC) .ui/mainframe.h -o .moc/moc_mainframe.cpp

.obj/qmake_image_collection.o: .ui/qmake_image_collection.cpp
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/qmake_image_collection.o .ui/qmake_image_collection.cpp

.ui/qmake_image_collection.cpp: images/filenew \
		images/fileopen \
		images/filesave \
		images/print \
		images/undo \
		images/redo \
		images/editcut \
		images/editcopy \
		images/editpaste \
		images/searchfind
	$(UIC)  -embed exoTKAD images/filenew images/fileopen images/filesave images/print images/undo images/redo images/editcut images/editcopy images/editpaste images/searchfind -o .ui/qmake_image_collection.cpp

####### Install

install: all 

uninstall: 

SOURCES	+= Document.cxx exoTKADMainFrame.cxx exoTKADChildFrame.cxx 
HEADERS	+= Document.hxx exoTKADMainFrame.hxx exoTKADChildFrame.hxx 
unix {
  UI_DIR = .ui
  MOC_DIR = .moc
  OBJECTS_DIR = .obj
}
FORMS	= childframe.ui mainframe.ui 
IMAGES	= images/filenew images/fileopen images/filesave images/print images/undo images/redo images/editcut images/editcopy images/editpaste images/searchfind 
TEMPLATE	=app
CONFIG	+= qt warn_on release thread
unix:DEFINES	+= LIN
INCLUDEPATH	+= ${CASROOT}/inc ${EXOTKROOT}/inc
LIBS	+= -L$(CASROOT)/Linux/lib -lTKernel -lexoTK -L$(EXOTKROOT)/lin/lib -lTKMath -lTKService -lTKG2d -lTKBRep -lTKG3d \
-lTKGeomBase -lTKV3d -lTKBool -lTKTopAlgo -lTKGeomAlgo -lTKFillet -lTKV2d -lTKPrim -lTKHLR
DBFILE	= exoTKAD.db
LANGUAGE	= C++

Message 4 in thread

Hi,

perhaps I found something :
if I rename my header files from <FILE>.hxx to <FILE>.h, it's seems to work.

Any idea why the header files SHOULD be .h ?

I will send an e-mail to trolltech.

Stephane
http://www.exotk.org



On March 18, 2002 16:45, Stephane Routelous wrote:
> Hi,
>
> I don't understand : I don't have moc files for this class.
> I'm using qmake.
> When I run the generated Makefile, I have
> Makefile:176: warning: overriding commands for target `.moc'
> Makefile:173: warning: ignoring old commands for target `.moc'
>
> Should not qmake generate the moc classes automatically ?
>
> I attach the .pro and the Makefile, if it can help
>
> TIA,
>
> Stephane
> http://www.exotk.org
>
> On March 18, 2002 16:23, Christopher Thompson wrote:
> > Make sure you are also linking the .moc.o files, this is likely your
> > problem. If that isn't the case, ensure that you are linking Qt 3 and not
> > Qt 2.x.
> >
> > On Monday 18 March 2002 2:18 pm, Stephane Routelous wrote:
> > > Hi,
> > >
> > > I'm using Qt3.0.2 on Linux ( Suse 7.2 )
> > >
> > > With designer ( .ui ) , I'm making a QMainWindow derived class :
> > > MainFrame I also have a class exoTKADMainFrame inheriting from
> > > MainFrame
> > >
> > > When I try to compile, I have the following errors :
> > >
> > > .obj/exoTKADMainFrame.o: In function
> > > `exoTKADMainFrame::exoTKADMainFrame(void)':
> > > .obj/exoTKADMainFrame.o(.text+0x1f): undefined reference to
> > > `exoTKADMainFrame::QPaintDevice virtual table'
> > > .obj/exoTKADMainFrame.o(.text+0x26): undefined reference to
> > > `exoTKADMainFrame virtual table'
> > > .obj/exoTKADMainFrame.o: In function
> > > `exoTKADMainFrame::~exoTKADMainFrame(void)':
> > > .obj/exoTKADMainFrame.o(.text+0x4f): undefined reference to
> > > `exoTKADMainFrame::QPaintDevice virtual table'
> > > .obj/exoTKADMainFrame.o(.text+0x56): undefined reference to
> > > `exoTKADMainFrame virtual table'
> > >
> > >
> > > What does that mean ?
> > > What should I do to solve these errors ?
> > >
> > > TIA,
> > >
> > > Stephane
> > > http://www.exotk.org
> > >
> > > PS : sorry, I'm quite a newbie in programming with Linux and Qt


Message 5 in thread

You have most likely forgotten to link in the moc file.

/Mauritz
Underscore AB

Stephane Routelous wrote:

>Hi,
>
>I'm using Qt3.0.2 on Linux ( Suse 7.2 )
>
>With designer ( .ui ) , I'm making a QMainWindow derived class : MainFrame 
>I also have a class exoTKADMainFrame inheriting from MainFrame
>
>When I try to compile, I have the following errors :
>
>.obj/exoTKADMainFrame.o: In function 
>`exoTKADMainFrame::exoTKADMainFrame(void)':
>.obj/exoTKADMainFrame.o(.text+0x1f): undefined reference to 
>`exoTKADMainFrame::QPaintDevice virtual table'
>.obj/exoTKADMainFrame.o(.text+0x26): undefined reference to `exoTKADMainFrame 
>virtual table'
>.obj/exoTKADMainFrame.o: In function 
>`exoTKADMainFrame::~exoTKADMainFrame(void)':
>.obj/exoTKADMainFrame.o(.text+0x4f): undefined reference to 
>`exoTKADMainFrame::QPaintDevice virtual table'
>.obj/exoTKADMainFrame.o(.text+0x56): undefined reference to `exoTKADMainFrame 
>virtual table'
>
>
>What does that mean ?
>What should I do to solve these errors ?
>
>TIA,
>
>Stephane
>http://www.exotk.org
>
>PS : sorry, I'm quite a newbie in programming with Linux and Qt
>
>--
>List archive and information: http://qt-interest.trolltech.com
>