[Solved] LNK1104: cannot open file 'debug\Project1.exe'



  • Hello,

    I try to make work a small program with qt in visual basic. I've already tried to show only a small button and it worked, then Qt is well installed. But with my new program the compiling gives the message: @LINK : fatal error LNK1104: cannot open file 'debug\Project1.exe' @

    I don't know from where it comes, maybe an error in my lines, but there are quite simple.. I give the code from main.cpp, MaFenetre.cpp and MaFenetre.h

    main.cpp

    @#include <iostream>
    #include "maFenetre.h"

    int main (int argc, char *argv[])
    {

    QApplication app(argc, argv);
    MaFenetre window;
    window.show();

    return app.exec();
    }@

    MaFenetre.h

    @#ifndef DEF_MAFENETRE
    #define DEF_MAFENETRE

    #include <QtGui>
    #include <QApplication>
    #include <QtWidgets>
    #include <QPushButton>

    class MaFenetre: public QWidget
    {
    public:
    MaFenetre();
    ~MaFenetre();
    void show();

    private:
    QPushButton *bouton;
    QProgressBar *barre;

    };

    #endif@

    MaFenetre.cpp

    @#include "maFenetre.h"

    MaFenetre::MaFenetre(): QWidget()
    {
    setFixedSize(200,100);

    bouton = new QPushButton("Hey");
    bouton->setText("Salut!");
    bouton->setFont(QFont("Lucida Handwriting",20));

    barre = new QProgressBar;
    barre->move(200,300);

    }

    MaFenetre::~MaFenetre()
    {
    delete bouton;
    delete barre;

    }

    void MaFenetre::show()
    {
    bouton->show();
    barre->show();
    }@



  • Hi,
    is that the only error message or are there some more?
    Should "project1.exe" be the name of your executable?



  • Hi, thank you for your reply. The global error message is

    @LINK : fatal error LNK1104: cannot open file 'debug\Project1.exe'
    1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\link.EXE"' : return code '0x450'
    1> Stop.
    1>NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\nmake.exe"' : return code '0x2'
    1> Stop.
    1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "qmake && nmake debug" exited with code 2.@

    Yes, the project1.exe is the name of my executable



  • Is "Project1.exe" currently executing ?
    The times I've seen this error is because the application
    is currently active. Check you process list, or in your
    case the task manager.



  • I agree with mranger90: project1.exe must be running yet, kill the process and you will be able to continue



  • It was the problem, the last time I executed the program there was nothing to show so that I couldn't quit the executable.

    Thank you very much!


  • Moderators

    bq. I try to make work a small program with qt in visual basic.

    Are you using Qt Creator? The code your are using is C++ by the way.

    bq. the last time I executed the program there was nothing to show so that I couldn’t quit the executable.

    Using Qt Creator it's possible to stop a running executable using the "Application Output" pane by clicking the red button there.

    There is a good tutorial "on the wiki":http://qt-project.org/wiki/Basic_Qt_Programming_Tutorial
    which shows the things you want to achieve.

    Do you realy want to make a program which shows a button and a progresbar in a separate window?
    Normally we put widgets like that in a layout together in one window.



  • Yeah, I'm training myself with visual because I must create a software with it and using Qt. So I try not to use Qt Creator except for Qt Designer.

    Thanks for the tutorial I will read that. I have seen for the separate windows, I created a QWidget and I included his name in the different QWidgets to obtain just one window at the end with the included elements.

    Is a layout very usefull if I always want the same window size? Why should I use it?



  • If you always have the same window size you will probably not need a layout. With a layout you are more flexible and smart if the size can be changed by the user.


  • Moderators

    Layouts make your ui style independent.
    What I mean by that is different users will have different system styles applied. boxes and buttons will differ in size, borders, font etc.
    Things like barre->move(200,300) will look like you intended only on your (and some amount of other) computers. It might well be that someone will set larger font or different DPI settings and it will result in overlapping ui elements. Layouts take care of that for you so you don't have to figure out those exact numbers for all possible system configurations out there.

    Also, it's a better idea not to manage destruction of the ui elements yourself. It's just too easy to forget one and leak. Instead of explicit delete bouton in the destructor just give it a parent in the constructor: bouton = new QPushButton("Hey", this); Then you don't have to think about it again since parent will delete all of its children when it's time.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.