Important: Please read the Qt Code of Conduct -

Problem Compiling In Release Mode

  • Whenever I compile my program in debug mode it works perfectly fine, however when I compile it in Release mode I get the following errors:

    @moc_mainwindow.cpp:-1: error: undefined reference to MainWindow::lowercase(QString)' moc_mainwindow.cpp:-1: error: undefined reference toMainWindow::on_label_linkActivated(QString const&)'
    moc_mainwindow.cpp:-1: error: undefined reference to MainWindow::on_ReadButton_clicked()' :-1: error: release/moc_mainwindow.o: bad reloc address 0x4 in'
    collect2.exe:-1: error: error: ld returned 1 exit status@

    The undefined error's are all pointing to functions I deleted in my program. I also "Ctrl-F"ed all of them in the moc_mainwindow.cpp and I couldn't find any of the functions. In addition usually when I double click the errors I usually get a reference showing where the error is in the code but it just says "File not found: moc_mainwindow.cpp"

  • Moderators

    Hi, and welcome to the Qt Dev Net!

    To do a proper clean-up, save your files and do:

    Build -> Clean Project "XYZ"

    Build -> Run qmake

    Build -> Build Projext "XYZ"

Log in to reply