Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unresolved external symbols

Unresolved external symbols

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blacpythoz
    wrote on last edited by blacpythoz
    #1

    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.

    D 1 Reply Last reply
    0
    • B blacpythoz

      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.

      D Offline
      D Offline
      Devopia53
      wrote on last edited by
      #2

      @blacpythoz

      Hi.

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

      LIBS += User32.lib

      B 1 Reply Last reply
      3
      • D Devopia53

        @blacpythoz

        Hi.

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

        LIBS += User32.lib

        B Offline
        B Offline
        blacpythoz
        wrote on last edited by
        #3

        @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)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved