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. [SOLVED]Linking problems: Qt5.5 32bit VS2013
QtWS25 Last Chance

[SOLVED]Linking problems: Qt5.5 32bit VS2013

Scheduled Pinned Locked Moved General and Desktop
5.5vs 2013
3 Posts 2 Posters 1.7k 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.
  • J Offline
    J Offline
    JasonKretzer
    wrote on 14 Sept 2015, 18:41 last edited by JasonKretzer
    #1

    I have been searching for an answer to this but no luck as yet.

    Using Qt5.5 32bit, VS2013 on Win8 64bit

    My .pro file contains this:

    INCLUDEPATH += "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include"
    LIBS += -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -ladvapi32
    

    I have checked both folders and WinUser.h is in the Include and User32.lib is present in the Lib.

    I have the following two functions in my code:

    void suppressAnimations()
    {
        ANIMATIONINFO m_original_settings;
        m_original_settings.cbSize = sizeof(m_original_settings);
        if (::SystemParametersInfo(SPI_GETANIMATION, sizeof(m_original_settings), &m_original_settings, 0)) {
            ANIMATIONINFO no_animation = { sizeof(no_animation), 0 };
            ::SystemParametersInfo(SPI_SETANIMATION, sizeof(no_animation), &no_animation, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
        }
    }
    

    AND

    int BackgroundTaskManager::changeMonitorState(bool turnOn)
    {
        int lparam = 2;
        if(turnOn) {
            lparam = -1;
            BackgroundTaskManager::MonitorIsSleeping = false;
        } else {
            lparam = 2;
            BackgroundTaskManager::MonitorIsSleeping = true;
        }
        return SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM)lparam);
    }
    

    I use this exact same code with Qt 5.3.2 32bit VS2010 on Windows 7 64bit and it compiles with no problems. In my current configuration, I get linking errors on the ::SystemParametersInfo and the SendMessage parts of the functions and a bunch of warnings on the headers.

    Warnings

    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include\sal_supp.h:57: warning: C4005: '__useHeader' : macro redefinition
    

    Linking Errors

    main.obj:-1: error: LNK2019: unresolved external symbol __imp__SystemParametersInfoW@16 referenced in function "void __cdecl suppressAnimations(void)" (?suppressAnimations@@YAXXZ)
    backgroundtaskmanager.obj:-1: error: LNK2019: unresolved external symbol __imp__SendMessageW@16 referenced in function "private: int __thiscall BackgroundTaskManager::changeMonitorState(bool)" (?changeMonitorState@BackgroundTaskManager@@AAEH_N@Z)
    

    Another bit of information, I tried this also using Qt5.5 32bit VS2013 on Win7 64bit and also received the errors as above. Yet another bit of information, in Qt Creator, I can press F2 over either of the symbols above and it takes me to the correct header.

    Could someone point me in the correct direction?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on 14 Sept 2015, 19:14 last edited by
      #2

      Well, the lib might be in the directory, but you didn't add it to the linker.

      LIBS += -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -ladvapi32 -luser32
      
      J 1 Reply Last reply 14 Sept 2015, 19:23
      1
      • L Leonardo
        14 Sept 2015, 19:14

        Well, the lib might be in the directory, but you didn't add it to the linker.

        LIBS += -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -ladvapi32 -luser32
        
        J Offline
        J Offline
        JasonKretzer
        wrote on 14 Sept 2015, 19:23 last edited by
        #3

        <walks away with head down>...
        @Leonardo Thanks!

        1 Reply Last reply
        0

        1/3

        14 Sept 2015, 18:41

        • Login

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