PDA

View Full Version : Qt4 to Qt3



ToddAtWSU
26th December 2006, 15:51
I have an application that I have written in Qt4 and I need to downconvert it to Qt3. This is not something I want to do but it is something I have been tasked to do. Everything compiled and built when I used my makefile for Qt4 but now I get an error that says
Qt meta object compiler
moc: Invalid argument
Then it provides me with a list of the valid arguments. I went to my moc from Qt 3.3.3 that I have to build down to and I printed out the list of moc arguments and compared it to the list of arguments in Qt 4.2.1 and I see that I have the same version of moc (Version 26 Qt 3.3.3) in both of my (QTDIR)/bin directories. Why would the makefile work fine with Qt 4.2.1 but not with Qt 3.3.3 since it says I have an invalide moc argument? My compile command looks like this (everything needs to be moc'd for this library).

%.o: $(SRC)/%.cpp
$(CXX) -c $(CFLAGS) $(DEFINES) $(INCPATH) $(SRC)/$*.cpp
$(QT)/bin/moc $(DEFINES) $(INCPATH) $(INC)/$*.h -o $(OBJECTS_DIR)/moc_$*.cpp
$(CXX) -c $(CFLAGS) $(DEFINES) $(INCPATH) -o $(OBJECTS_DIR)/moc_$*.o $(OBJECTS_DIR)/moc_$.cpp

Above this compilation line is where I set all my variables and they look like (and they do use tabs but I will leave out the tabs for this post. I commented out the DEFINES because I thought this looked like a Qt 4.2.1 thing and not a Qt 3.3.3 since QT 3.3.3 only has 1 library. Is this correct?:

SRC = ../src
TARGET = libraryName.a
QT = /usr/lib64/qt-3.3
CXX = g++
CFLAGS = -m64 -pipe -g -D_REENTRANT -W
DEFINES = #-DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_STATIC
INCPATH = -I$(QT)/mkspecs/linux-g++-64 \
-I$(QT)/include \... (the rest are not Qt paths)
OBJECTS_DIR = .
LINK = $(CXX)
LFLAGS =
LIBPATH = -L$(QT)/lib \ ... (the rest are not Qt paths)
LIBS = -lqt-mt \ ... (the rest are not Qt libraries)
AR = ar cqs
QMAKE = $(QT)/bin/qmake

The build command is:

all: $(TARGET)

$(TARGET): $(OBJECTS)
$(AR) $(TARGET) *.o

The rest of the variables seem to be unnecessary to write in. Can anybody see anything here that would cause my error for moc'ing? Thanks for any help you have and if you need anymore information please let me know what information I can provide you with.

wysota
26th December 2006, 16:24
If you use qmake, then why not make it regenerate the makefile from the project file?

ToddAtWSU
26th December 2006, 20:14
I don't think qmake is actually being used. I did not write this original makefile but since it worked for the 4.2.1 stuff I figured I should just reuse it for the 3.3.3 downconversion. The entire GUI was built by hand, not be the GUI builder. My friend and I feel we have more control over our GUI and how the code looks by writing the entire GUI interface. Plus it is very simple to do. So because we wrote our own GUI, I don't think we have a .pro file. Sorry if I am wrong in thinking the GUI builder is what creates the .pro file but I am certain we do not have one. I would ask my friend about the makefile since he wrote it, but he is out of town for the next week or two meaning he cannot help me. Any other ideas? Thanks!

wysota
26th December 2006, 20:17
Well, the problem is that moc works in a bit different way in Qt3 and Qt4. It would really be easiest if you just used qmake for the time being (I suggest running qmake -project) and when your friend is back, you can ask him to rewrite the makefile.

ToddAtWSU
27th December 2006, 16:37
For the line:


$(QT)/bin/moc $(DEFINES) $(INCPATH) $(INC)/$*.h -o $(OBJECTS_DIR)/moc_$*.cpp

I took out the part that said $(INCPATH) and it compiled fine. Thanks for your help!