Results 1 to 5 of 5

Thread: Qt4 to Qt3

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Unhappy Qt4 to Qt3

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4 to Qt3

    If you use qmake, then why not make it regenerate the makefile from the project file?

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 to Qt3

    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!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt4 to Qt3

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt4 to Qt3

    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!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.