Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:16:08+00:00 2026-06-04T19:16:08+00:00

I started to work for my homework using QT creator to make the GUI,

  • 0

I started to work for my homework using QT creator to make the GUI, but I gt this error and I can’t manage to find the reason for it, nor can I understand what it means. I suppose it sees my main function twice but I do not know why… please assist me in fixing this error:

error:

Makefile.Debug:155: warning: overriding commands for target `debug/main.o'
    Makefile.Debug:142: warning: ignoring old commands for target `debug/main.o'
    debug/main.o: In function `Z5qMainiPPc':
    D:\c++\Labs\GUI_r/../../../info/qt/Desktop/Qt/4.8.1/mingw/include/QtGui/qwidget.h:494: multiple definition of `qMain(int, char**)'
    debug/main.o:D:\c++\Labs\GUI_r/main.cpp:7: first defined here
    collect2: ld returned 1 exit status

Code:

#include <QtGui/QApplication>
#include "mainwindow.h"
#include "controller.h"
#include "StudentRepository.h"

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

    StudentRepository *stre = new StudentRepository();
    Controller *c = new Controller(stre);
    MainWindow w(c);
    w.show();

    return a.exec();
}

edit: long code removed – not the reason for the error. Check the answere it is useful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:16:10+00:00Added an answer on June 4, 2026 at 7:16 pm

    The reason for that linking error is because of awkawrd behaivior behalf QT creator. I had in the projectName.pro –

    QT       +=    core gui
    
    TARGET = GUI_r
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp \
        main.cpp \                   /////// Double call of main.cpp
        StudentRepository.cpp \
        controller.cpp
    
    HEADERS  += mainwindow.h \
        controller.h \
        StudentRepository.h \
    Student.h \
    ui_mainwindow.h \        /////Double call of ui_mainwindow.h 
    ui_mainwindow.h
    
    FORMS    += mainwindow.ui
    

    Thank you, i hope this post will be usefull to other new users of QTcreator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started to work with Silverlight and wanted to know how I can
I just started to work on informix.( I have been using mysql all my
At work I just started using Subversion with AnkhSVN instead of Visual Source Safe.
I've started work on an ASP.Net project and for some reason Visual Studio keeps
I have just started to work with jquery so I need to make sure
I haven't started work in this yet, however I intend to and would like
I've started work on my first mvc project and also using jquery for the
I recently started work on a personal coding project using C++ and KDevelop. Although
I've recently started work on developing a site using Magento. All of my files
This is not a homework problem, though it is a work problem. Where months

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.