Dependent 'main' does not exist



  • just editing my QT application and after building the error;

    :-1: error: dependent 'main' does not exist.

    has appeared. Any ideas? New to QT so really no idea about the program etc, here is my main file;
    @
    #include "widget.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    Widget File

    #include "widget.h"
    #include "ui_widget.h"
    #include "shipHandler.h"
    #include "navalVessels.h"

    Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
    {
    ui->setupUi(this);

    SDI::shipHandler shipHandler("ships.txt");
    sh = shipHandler;
    Widget::populateCombo();
    

    }

    Widget::~Widget()
    {
    delete ui;
    }

    void Widget::populateCombo()
    {
    for( std::vectorSDI::navalVessels*::const_iterator i = sh.ships.begin(); i != sh.ships.end(); ++i)
    {
    SDI::navalVessels* ship = *i;
    QString qstr = QString::fromStdString(ship->name);
    ui->comboBox->addItem(qstr);
    }
    }
    @

    [edit: add coding tags @ SGaist]


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you also share your pro file ?


Log in to reply
 

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