Results 1 to 3 of 3

Thread: how to debug with qt

  1. #1
    Join Date
    Jan 2016
    Posts
    22
    Thanks
    13

    Default how to debug with qt

    hello,
    i want to know how to debug with Qt because i want to execute this code but it gives an error.
    imageViewer.h
    Qt Code:
    1. #ifndef IMAGEVIEWER_H
    2. #define IMAGEVIEWER_H
    3. #include<QtWidgets>
    4.  
    5. class ImageViewer : public QMainWindow
    6. {
    7. Q_OBJECT
    8. public:
    9. ImageViewer();
    10. public slots:
    11. void ouvrir();
    12. private:
    13. QLabel *label;
    14. QImage *image;
    15. QVBoxLayout *layout;
    16. };
    17.  
    18. #endif // IMAGEVIEWER_H
    To copy to clipboard, switch view to plain text mode 
    imageViewer.cpp
    Qt Code:
    1. #include "imageviewer.h"
    2.  
    3. ImageViewer::ImageViewer(): QMainWindow()
    4. {
    5. label = new QLabel(this);
    6.  
    7. label->move(100,100);
    8. label->setFixedSize(500,500);
    9. layout = new QVBoxLayout(this);
    10. layout->addWidget(label);
    11. this->setLayout(layout);
    12. QMenu *fichier = menuBar()->addMenu("Fichier");
    13. QMenu *edition = menuBar()->addMenu("Edition");
    14.  
    15. QAction *ouvrir = new QAction("Ouvrir",this);
    16. fichier->addAction(ouvrir);
    17. connect(ouvrir,SIGNAL(triggered(bool)),this,SLOT(ouvrir()));
    18.  
    19.  
    20.  
    21. }
    22.  
    23. void ImageViewer::ouvrir()
    24. {
    25. QString nomFichier = QFileDialog::getOpenFileName(this,"Open file", "C://");
    26. image = new QImage(nomFichier);
    27. label->setPixmap(QPixmap::fromImage(QImage(nomFichier)));
    28. }
    To copy to clipboard, switch view to plain text mode 
    and the error is
    cannot open output file debug\app.exe: Permission denied
    error: ld returned 1 exit status

    Thank you.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to debug with qt

    There is still a copy of your executable running, which will block any attempt to rewrite the exe. Open Windows task manager and find the app.exe to terminate or show it.

    This situation can arise if the program main() has been constructed to not exit when the last window closes.

    You can use the debugger matching your toolchain (gdb or cdb) to single-step, breakpoint, and inspect a debug build of your program. This function is essentially independent of Qt itself, although your IDE can typically help with the launch, control and display of the resulting debug session. You cannot do this if you cannot build the program you intend to run.

  3. The following user says thank you to ChrisW67 for this useful post:

    rafik (12th February 2016)

  4. #3
    Join Date
    Jan 2016
    Posts
    22
    Thanks
    13

    Default Re: how to debug with qt

    after restarting the copy is removed, but for the debug are there any good tutorial to understand what is the toolchain and the breakpoints? because i am not familiar with this.
    Last edited by rafik; 12th February 2016 at 23:49.

Similar Threads

  1. Replies: 1
    Last Post: 10th October 2012, 08:46
  2. Qt + Linux + Eclipse - debug using debug build?
    By will49 in forum Qt Programming
    Replies: 6
    Last Post: 13th April 2012, 06:27
  3. Replies: 4
    Last Post: 30th September 2010, 10:31
  4. DEBUG macro not defined in debug build using vc++
    By piotr.dobrogost in forum Qt Programming
    Replies: 0
    Last Post: 21st July 2009, 13:07
  5. Replies: 11
    Last Post: 22nd March 2006, 19:06

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.