Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

<SOLVED>error in basic C++ program



  • Am programming in C++ and made a skeleton program to play around with. Just experimenting a bit.

    Wizard: Application--> Qt console app

     .pro
    
    QT       += core
    
    QT       -= gui
    
    QT       += widgets
    
    TARGET = Hello_World_console
    CONFIG   += console
    CONFIG   -= app_bundle
    
    TEMPLATE = app
    
    SOURCES += main.cpp
    

    main.cpp

    #include <QCoreApplication>
    #include <iostream>
    using namespace std;
    
    int main ()
    {
        int num1,num2;
       
        return 0;
    }
    

    Get this error:
    :-1: error: C:/Qt/Tools/mingw491_32/bin/../libexec/gcc/i686-w64-mingw32/4.9.1/liblto_plugin-0.dll: error loading plugin: "C:\Qt\Tools\mingw491_32\bin..\libexec\gcc\i686-w64-mingw32\4.9.1\liblto_plugin-0.dll":

    Any thoughts?


  • Moderators

    Not really a straightforward answer but few things to notice:

    QT -= gui
    QT += widgets
    This makes little sense. If you want a console app don't add widgets.

    "C:\Qt\Tools\mingw491_32\bin..\libexec\gcc\i686-w64-mingw32\4.9.1\liblto_plugin-0.dll"
    There's a missing \ after bin. Is that the output you're getting or is it an output -> forum transfer mistake?

    The internet wisdom suggest two problems with the lto plugin in MinGW: one - it doesn't like spaces in paths. Does your project live in such location? A longshot but there's also a bug report on packaging of some versions of MinGW where they would add a 64bit plugin to a 32 bit compiler. Can you share some bittness info of your build and OS? In any case a workaround is to remove the -flto from the compiler command line so you might try that.



  • "C:\Qt\Tools\mingw491_32\bin..\libexec\gcc\i686-w64-mingw32\4.9.1\liblto_plugin-0.dll"
    

    \bin..\ - this goes down the tree terminating in the bin folder; then goes back up a directory and finds libexec then back down to liblto_plugin-0.dll which is there. You probably already see that - just thought I would verify.

    This is a copy and paste -- no transfer error. OS Win 8.1 current on updates, 32gb ram, 64 bit sys. If you suggest that I do the workaround might need a few instructions. Also, I am not aware of any whitespaces. Fresh install of QT and Qt Creator. Could reinstall and see if the problem goes away (sorry abt the magical thinking). Interestingly when I install it never makes a shortcut for me.

    Oddly the first few times I ran this it would work. I don't know what's changed since.
    Would a direct include path to the location be helpful?



  • Ok, works fine now. The only thing I am aware of doing is installing Eclipse and updating Java. Have no idea.


Log in to reply