Unresolved external symbols



  • I jhad this code inside qt-creator

    main.cpp

    #include "windows.h"
    #include <QCoreApplication>
    int main(int argc, char *argv[])    
    {
        QCoreApplication a(argc, argv);
        char file[]= "E:\\test.bmp";
        SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, &file, SPIF_UPDATEINIFILE |SPIF_SENDWININICHANGE);
        return a.exec();
    

    }

    testWallpaper.pro

    QT += core
    QT -= gui
    
    CONFIG += c++11
    
    TARGET = TestWallpaper
    CONFIG += console
    CONFIG -= app_bundle
    
    TEMPLATE = app
    
    SOURCES += main.cpp
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    

    Codeblock Version

    #include "windows.h"
    int main(int argc, char *argv[])
    {
        char *file="E:\\test.bmp";
       SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, file, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
    }
    

    The Code block version runs fine but whenever I tried to run from qt-creator I got the issue:

    main.obj:-1: error: LNK2019: unresolved external symbol __imp_SystemParametersInfoA referenced in function main
    debug\TestWallpaper.exe:-1: error: LNK1120: 1 unresolved externals
    

    Why is this happenning ?? I am trying to set the desktop wallpaper.



  • @blacpythoz

    Hi.

    Which compiler version are you using? If it is an MSVC version, like this:

    LIBS += User32.lib



  • @Devopia53 said in Unresolved external symbols:

    Which compiler version are you using? If it is an MSVC version, like this:

    0_1486543834960_Capture.PNG image url)


Log in to reply
 

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