Qt World Summit: Submit your Presentation

Console application falls if I start it from Creator, but works when i just open .exe

  • Hi!
    I built some small console application using SFML lib, but it falls when i run it from creator (I see only "Press <RETURN> to close this window..."), but it works if i'm starting .exe file.
    I added "c:\SFML\bin" to PATH.
    pro file:

    QT -= gui
    CONFIG += c++11 console
    CONFIG -= app_bundle
    SOURCES += \
            main.cpp #UDP.cpp
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    LIBS += -LC:/SFML/lib
    CONFIG(release, debug|release): LIBS += -LC:/SFML/lib/ -lsfml-window -lsfml-main -lsfml-system
    CONFIG(debug, debug|release): LIBS += -LC:/SFML/lib/ -lsfml-window-d -lsfml-main-d -lsfml-system-d
    INCLUDEPATH += C:/SFML/include
    DEPENDPATH += C:/SFML/include

  • Lifetime Qt Champion

    @BrMisha Any error messages?
    Can you post the code?

  • Yes)))

    int main(int argc, char *argv[])
    	QCoreApplication a(argc, argv);
    	return a.exec();

    How i can understand, problems with attached libs

  • Lifetime Qt Champion

    @BrMisha Interesting. Usually it is other way around: it starts in QtCreator, but not outside :-)
    Probably the system can't find the lib for some reason when you start the app from QtCreator.
    Do you build in Debug mode?

  • Yeah, debug, but with release some situation.
    At first, it did fall when i did start .exe also, but then i added .dll folder to path.

  • by the way, libs linked in pro file if .a, not .dll. May be it is problem?

  • WOW!!!
    In pro i set links to dll and now i can start from creator)))

Log in to reply