Partage
  • Partager sur Facebook
  • Partager sur Twitter

[Qt sous Linux] Impossible de compiler

Les codes du tuto de hiura (libmanquante ?)

Sujet résolu
    4 septembre 2007 à 18:18:00

    Bonjours aprés avoir lut le tuto de hiura j'ai essayer de compiler les sources qui sont utiliser dans le tuto (aprés avoir bien installer qt4-dev qt4-core qt4-dev-tool...).

    J'ai récupérer les code que du tuto directement sur le site (le lien ftp ne fonctionnne pas ...)

    je tape
    qmake -project

    qmake

    make


    et j'obtiens :
    1. cannonfield.cpp:39:24: erreur: QPaintEvent : Aucun fichier ou répertoire de ce type
    2. cannonfield.cpp:40:21: erreur: QPainter : Aucun fichier ou répertoire de ce type
    3. Dans le fichier inclus à partir de cannonfield.cpp:42:
    4. cannonfield.h:42:20: erreur: QWidget : Aucun fichier ou répertoire de ce type
    5. cannonfield.h:45: erreur: expected class-name before «{" token
    6. cannonfield.h:46: erreur: ISO C++ forbids declaration of «Q_OBJECT" with no type
    7. cannonfield.h:48: erreur: expected «;" before «public"
    8. cannonfield.h:54: erreur: expected `:' before «slots"
    9. cannonfield.h:55: erreur: expected primary-expression before «void"
    10. cannonfield.h:55: erreur: ISO C++ forbids declaration of «slots" with no type
    11. cannonfield.h:55: erreur: expected «;" before «void"
    12. cannonfield.h:59: erreur: expected primary-expression before «void"
    13. cannonfield.h:59: erreur: ISO C++ forbids declaration of «signals" with no type
    14. cannonfield.h:59: erreur: expected «;" before «void"
    15. cannonfield.h:63: erreur: «QPaintEvent" has not been declared
    16. cannonfield.h:66: erreur: «QRect" does not name a type
    17. cannonfield.cpp:44: erreur: expected `)' before «*" token
    18. cannonfield.cpp:53: erreur: no «void CannonField::setAngle(int)" member function declared in class «CannonField"
    19. cannonfield.cpp: In member function «void CannonField::setAngle(int)":
    20. cannonfield.cpp:62: erreur: «cannonRect" was not declared in this scope
    21. cannonfield.cpp:62: erreur: «update" was not declared in this scope
    22. cannonfield.cpp:63: erreur: «emit" was not declared in this scope
    23. cannonfield.cpp:63: erreur: expected `;' before «angleChanged"
    24. cannonfield.cpp: In member function «void CannonField::setForce(int)":
    25. cannonfield.cpp:73: erreur: «emit" was not declared in this scope
    26. cannonfield.cpp:73: erreur: expected `;' before «forceChanged"
    27. cannonfield.cpp: At global scope:
    28. cannonfield.cpp:76: erreur: variable or field «paintEvent" declared void
    29. cannonfield.cpp:76: erreur: «int CannonField::paintEvent" is not a static member of «class CannonField"
    30. cannonfield.cpp:76: erreur: «QPaintEvent" was not declared in this scope
    31. cannonfield.cpp:76: erreur: expected primary-expression before «)" token
    32. cannonfield.cpp:77: erreur: expected «," or «;" before «{" token
    33. cannonfield.cpp:89: erreur: «QRect" does not name a type
    34. make: *** [cannonfield.o] Erreur 1


    Il semble manquer des lib sauf que je les ai normalement installer...

    Voila merci de votre aide.

    • Partager sur Facebook
    • Partager sur Twitter
      5 septembre 2007 à 0:24:27

      Tu as bien copier tous les fichiers et tu as fait un "cd" (change directory) avant de compiler ?
      • Partager sur Facebook
      • Partager sur Twitter
        5 septembre 2007 à 12:17:40

        J'ai copier les 5 fichiers puis je me suis placé (en console) dans le répertoire et j'ai lancé les 3 commandes.
        • Partager sur Facebook
        • Partager sur Twitter
          5 septembre 2007 à 12:19:23

          Tu peux nous faire voir le contenu du makefile ?
          • Partager sur Facebook
          • Partager sur Twitter
          Co-auteur du cours de C++. ||| Posez vos questions sur le forum ||| Me contacter.
            5 septembre 2007 à 12:41:50

            Ok

            1. #############################################################################
            2. # Makefile for building: t10
            3. # Generated by qmake (1.07a) (Qt 3.3.7) on: Wed Sep  5 12:16:26 2007
            4. # Project:  t10.pro
            5. # Template: app
            6. # Command: $(QMAKE) -o Makefile t10.pro
            7. #############################################################################
            8. ####### Compiler, tools and options
            9. CC       = gcc
            10. CXX      = g++
            11. LEX      = flex
            12. YACC     = yacc
            13. CFLAGS   = -pipe -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
            14. CXXFLAGS = -pipe -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT
            15. LEXFLAGS =
            16. YACCFLAGS= -d
            17. INCPATH  = -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3
            18. LINK     = g++
            19. LFLAGS   =
            20. LIBS     = $(SUBLIBS) -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
            21. AR       = ar cqs
            22. RANLIB   =
            23. MOC      = /usr/share/qt3/bin/moc
            24. UIC      = /usr/share/qt3/bin/uic
            25. QMAKE    = qmake
            26. TAR      = tar -cf
            27. GZIP     = gzip -9f
            28. COPY     = cp -f
            29. COPY_FILE= $(COPY)
            30. COPY_DIR = $(COPY) -r
            31. INSTALL_FILE= $(COPY_FILE)
            32. INSTALL_DIR = $(COPY_DIR)
            33. DEL_FILE = rm -f
            34. SYMLINK  = ln -sf
            35. DEL_DIR  = rmdir
            36. MOVE     = mv -f
            37. CHK_DIR_EXISTS= test -d
            38. MKDIR    = mkdir -p
            39. ####### Output directory
            40. OBJECTS_DIR = ./
            41. ####### Files
            42. HEADERS = cannonfield.h \
            43.                 lcdrange.h
            44. SOURCES = cannonfield.cpp \
            45.                 lcdrange.cpp \
            46.                 main.cpp
            47. OBJECTS = cannonfield.o \
            48.                 lcdrange.o \
            49.                 main.o
            50. FORMS =
            51. UICDECLS =
            52. UICIMPLS =
            53. SRCMOC   = moc_cannonfield.cpp \
            54.                 moc_lcdrange.cpp
            55. OBJMOC = moc_cannonfield.o \
            56.                 moc_lcdrange.o
            57. DIST       = t10.pro
            58. QMAKE_TARGET = t10
            59. DESTDIR  =
            60. TARGET   = t10
            61. first: all
            62. ####### Implicit rules
            63. .SUFFIXES: .c .o .cpp .cc .cxx .C
            64. .cpp.o:
            65.         $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
            66. .cc.o:
            67.         $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
            68. .cxx.o:
            69.         $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
            70. .C.o:
            71.         $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
            72. .c.o:
            73.         $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
            74. ####### Build rules
            75. all: Makefile $(TARGET)
            76. $(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)  
            77.         $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
            78. mocables: $(SRCMOC)
            79. uicables: $(UICDECLS) $(UICIMPLS)
            80. $(MOC):
            81.         ( cd $(QTDIR)/src/moc && $(MAKE) )
            82. Makefile: t10.pro  /usr/share/qt3/mkspecs/default/qmake.conf /usr/share/qt3/lib/libqt-mt.prl
            83.         $(QMAKE) -o Makefile t10.pro
            84. qmake:
            85.         @$(QMAKE) -o Makefile t10.pro
            86. dist:
            87.         @mkdir -p .tmp/t10 && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/t10/ && ( cd `dirname .tmp/t10` && $(TAR) t10.tar t10 && $(GZIP) t10.tar ) && $(MOVE) `dirname .tmp/t10`/t10.tar.gz . && $(DEL_FILE) -r .tmp/t10
            88. mocclean:
            89.         -$(DEL_FILE) $(OBJMOC)
            90.         -$(DEL_FILE) $(SRCMOC)
            91. uiclean:
            92. yaccclean:
            93. lexclean:
            94. clean: mocclean
            95.         -$(DEL_FILE) $(OBJECTS)
            96.         -$(DEL_FILE) *~ core *.core
            97. ####### Sub-libraries
            98. distclean: clean
            99.         -$(DEL_FILE) $(TARGET) $(TARGET)
            100. FORCE:
            101. ####### Compile
            102. cannonfield.o: cannonfield.cpp cannonfield.h
            103. lcdrange.o: lcdrange.cpp lcdrange.h
            104. main.o: main.cpp cannonfield.h \
            105.                 lcdrange.h
            106. moc_cannonfield.o: moc_cannonfield.cpp  cannonfield.h
            107. moc_lcdrange.o: moc_lcdrange.cpp  lcdrange.h
            108. moc_cannonfield.cpp: $(MOC) cannonfield.h
            109.         $(MOC) cannonfield.h -o moc_cannonfield.cpp
            110. moc_lcdrange.cpp: $(MOC) lcdrange.h
            111.         $(MOC) lcdrange.h -o moc_lcdrange.cpp
            112. ####### Install
            113. install:  
            114. uninstall:
            • Partager sur Facebook
            • Partager sur Twitter
              5 septembre 2007 à 13:24:29

              Ok, je vois l'erreur.

              Ce makefile est pour Qt3 et toi tu as installer qt4, ça ne peut pas marcher.
              • Partager sur Facebook
              • Partager sur Twitter
              Co-auteur du cours de C++. ||| Posez vos questions sur le forum ||| Me contacter.
                5 septembre 2007 à 13:28:59

                Ah et je fais comment ?

                Edit : Aprés recherche je ne trouve dans mon gestionaire de paquets ni qt3-core ni qt4-dev-tool.
                • Partager sur Facebook
                • Partager sur Twitter
                Anonyme
                  5 septembre 2007 à 13:37:19

                  chez moi c'est qmake-qt4 a la place de qmake
                  • Partager sur Facebook
                  • Partager sur Twitter
                    5 septembre 2007 à 13:42:08

                    Ok merci beaucoup Davidbrcz maintenant que je tape qmake-qt4 à la place de qmake ça marche!
                    • Partager sur Facebook
                    • Partager sur Twitter
                    Anonyme
                      5 septembre 2007 à 14:02:27

                      c'est bizard car moi j'utilise bien qmake... et j'ai bien la version 4 d'installé....Le problème vient d'où ?
                      • Partager sur Facebook
                      • Partager sur Twitter
                        5 septembre 2007 à 15:40:16

                        Tu as peut-être aussi la 3 d'intallé... :p
                        • Partager sur Facebook
                        • Partager sur Twitter
                        Co-auteur du cours de C++. ||| Posez vos questions sur le forum ||| Me contacter.
                        Anonyme
                          5 septembre 2007 à 15:51:35

                          c'est pas ce que me dis le synaptic. J'ai seulement un truque obligatoire du 3,mais j'ai bien qt4 dev...
                          • Partager sur Facebook
                          • Partager sur Twitter
                            5 septembre 2007 à 15:52:26

                            Dans ce cas, c'est la magie de l'informatique.
                            • Partager sur Facebook
                            • Partager sur Twitter
                            Co-auteur du cours de C++. ||| Posez vos questions sur le forum ||| Me contacter.
                            Anonyme
                              5 septembre 2007 à 19:44:02

                              Oui trés cool (surtout quand ça tombe sur bibi).
                              • Partager sur Facebook
                              • Partager sur Twitter

                              [Qt sous Linux] Impossible de compiler

                              × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                              × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                              • Editeur
                              • Markdown