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. Using qplatformdefs.h on windows
Forum Updated to NodeBB v4.3 + New Features

Using qplatformdefs.h on windows

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 1.4k 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.
  • A Offline
    A Offline
    Abdulmueez
    wrote on last edited by aha_1980
    #1

    Hello,
    I am still trying to use this guide (https://wiki.qt.io/Karchive_on_windows) to install KArchive, I am currently in the last step, which is calling nmake install, but I am running into some problems

    error C2061: syntax error: identifier 'mode_t'
    

    I have tried typedefing the mode_t to int, this allows me to move on but during the linking stage, I had a lot more errors(271 actually). So, this made me think I used a wrong method to solve the initial problem. So, I went through the files and noticed that the mode_t was from this particular header

    #include <qplatformdefs.h>
    

    On searching online, I noticed that the header works only on Linux platforms and I am using windows, I am currently stuck on what to do. Can someone help me out please?

    jsulmJ 1 Reply Last reply
    0
    • A Abdulmueez

      Hello,
      I am still trying to use this guide (https://wiki.qt.io/Karchive_on_windows) to install KArchive, I am currently in the last step, which is calling nmake install, but I am running into some problems

      error C2061: syntax error: identifier 'mode_t'
      

      I have tried typedefing the mode_t to int, this allows me to move on but during the linking stage, I had a lot more errors(271 actually). So, this made me think I used a wrong method to solve the initial problem. So, I went through the files and noticed that the mode_t was from this particular header

      #include <qplatformdefs.h>
      

      On searching online, I noticed that the header works only on Linux platforms and I am using windows, I am currently stuck on what to do. Can someone help me out please?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @abdulmueez What exact Qt version do you use and what exact compiler version?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Abdulmueez
        wrote on last edited by
        #3

        My Qt Version is Qt 5.12.2 and the compiler is Mingw 7.3.0.

        Although I am running the nmake install from the visual studio cmd because in the qt cmd , I am getting the error

        'nmake' is not recognized as an internal or external command,
        operable program or batch file.
        

        I don't know whether the error is from there?

        jsulmJ 1 Reply Last reply
        0
        • A Abdulmueez

          My Qt Version is Qt 5.12.2 and the compiler is Mingw 7.3.0.

          Although I am running the nmake install from the visual studio cmd because in the qt cmd , I am getting the error

          'nmake' is not recognized as an internal or external command,
          operable program or batch file.
          

          I don't know whether the error is from there?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @abdulmueez "error C2061: syntax error: identifier 'mode_t'" - this looks like an error message from Microsoft compiler not MinGW. Are you sure you're using the correct compiler?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A Offline
            A Offline
            Abdulmueez
            wrote on last edited by
            #5

            The Microsoft compiler is what I am using with Visual studio, the mingw is for qt.
            Should I change the qt compiler to the Microsoft compiler?

            jsulmJ 1 Reply Last reply
            0
            • A Abdulmueez

              The Microsoft compiler is what I am using with Visual studio, the mingw is for qt.
              Should I change the qt compiler to the Microsoft compiler?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @abdulmueez You have to use same compiler as was used to build Qt you installed. If you installed Qt for MinGW then use MinGW, if you installed Qt for Microsoft compiler then use Microsoft compiler.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • A Offline
                A Offline
                Abdulmueez
                wrote on last edited by
                #7

                Sorry please, I'm a little bit confused, Do you mean I should change the compiler in the visual studio to match the one in my Qt

                jsulmJ 1 Reply Last reply
                0
                • A Abdulmueez

                  Sorry please, I'm a little bit confused, Do you mean I should change the compiler in the visual studio to match the one in my Qt

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #8

                  @abdulmueez If you're using Visual Studio then you need to install Qt for your version of Visual Studio, because you can't use Qt built with MinGW in Visual Studio. You can't mix binaries built using different C++ compilers. And Visual Studio can't use MinGW as compiler...

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  4
                  • A Offline
                    A Offline
                    Abdulmueez
                    wrote on last edited by
                    #9

                    Alright, I think I get it now, I will try it out and check back. Thanks a lot for your help

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Abdulmueez
                      wrote on last edited by
                      #10

                      Hello,
                      So, I have been able to get past this error by changing the qt directories used to x86 msvc, but I am running into a new error

                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol __imp__RoInitialize@4 referenced in function _WinMain@16
                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol __imp__RoGetActivationFactory@12 referenced in function "public: __thiscall AppContainer::AppContainer(void)" (??0AppContainer@@QAE@XZ)
                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsCreateStringReference@16 referenced in function "private: void __thiscall Microsoft::WRL::Wrappers::HStringReference::CreateReference(wchar_t const *,unsigned int,unsigned int)" (?CreateReference@HStringReference@Wrappers@WRL@Microsoft@@AAEXPB_WII@Z)
                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsDeleteString@4 referenced in function "public: void __thiscall Microsoft::WRL::Wrappers::HString::Release(void)" (?Release@HString@Wrappers@WRL@Microsoft@@QAEXXZ)
                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsGetStringRawBuffer@8 referenced in function "public: wchar_t const * __thiscall Microsoft::WRL::Wrappers::HString::GetRawBuffer(unsigned int *)const " (?GetRawBuffer@HString@Wrappers@WRL@Microsoft@@QBEPB_WPAI@Z)
                      qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _RoOriginateError@8 referenced in function "public: static void __cdecl Microsoft::WRL::ErrorHelper<0>::OriginateError(long,struct HSTRING__ *)" (?OriginateError@?$ErrorHelper@$0A@@WRL@Microsoft@@SAXJPAUHSTRING__@@@Z)
                      ..\bin\kziptest.exe : fatal error LNK1120: 6 unresolved externals
                      

                      Although I have found pages that provides solutions to the error but most of the explanation seems to be flying over my head. The links I found include

                      https://forum.qt.io/topic/64488/visual-studio-2015-unresolved-external-symbols-in-qtmaind-lib
                      https://stackoverflow.com/questions/16466641/how-to-declare-and-link-to-roinitialize-rouninitialize-rogetactivationfactory-an
                      

                      Can someone kindly work me through the steps I need to take, What I know about linking is just including the header files, I don't know how to link a .lib file

                      aha_1980A 1 Reply Last reply
                      0
                      • A Abdulmueez

                        Hello,
                        So, I have been able to get past this error by changing the qt directories used to x86 msvc, but I am running into a new error

                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol __imp__RoInitialize@4 referenced in function _WinMain@16
                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol __imp__RoGetActivationFactory@12 referenced in function "public: __thiscall AppContainer::AppContainer(void)" (??0AppContainer@@QAE@XZ)
                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsCreateStringReference@16 referenced in function "private: void __thiscall Microsoft::WRL::Wrappers::HStringReference::CreateReference(wchar_t const *,unsigned int,unsigned int)" (?CreateReference@HStringReference@Wrappers@WRL@Microsoft@@AAEXPB_WII@Z)
                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsDeleteString@4 referenced in function "public: void __thiscall Microsoft::WRL::Wrappers::HString::Release(void)" (?Release@HString@Wrappers@WRL@Microsoft@@QAEXXZ)
                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _WindowsGetStringRawBuffer@8 referenced in function "public: wchar_t const * __thiscall Microsoft::WRL::Wrappers::HString::GetRawBuffer(unsigned int *)const " (?GetRawBuffer@HString@Wrappers@WRL@Microsoft@@QBEPB_WPAI@Z)
                        qtmaind.lib(qtmain_winrt.obj) : error LNK2019: unresolved external symbol _RoOriginateError@8 referenced in function "public: static void __cdecl Microsoft::WRL::ErrorHelper<0>::OriginateError(long,struct HSTRING__ *)" (?OriginateError@?$ErrorHelper@$0A@@WRL@Microsoft@@SAXJPAUHSTRING__@@@Z)
                        ..\bin\kziptest.exe : fatal error LNK1120: 6 unresolved externals
                        

                        Although I have found pages that provides solutions to the error but most of the explanation seems to be flying over my head. The links I found include

                        https://forum.qt.io/topic/64488/visual-studio-2015-unresolved-external-symbols-in-qtmaind-lib
                        https://stackoverflow.com/questions/16466641/how-to-declare-and-link-to-roinitialize-rouninitialize-rogetactivationfactory-an
                        

                        Can someone kindly work me through the steps I need to take, What I know about linking is just including the header files, I don't know how to link a .lib file

                        aha_1980A Offline
                        aha_1980A Offline
                        aha_1980
                        Lifetime Qt Champion
                        wrote on last edited by aha_1980
                        #11

                        @abdulmueez said in Using qplatformdefs.h on windows:

                        RoOriginateError

                        Are you by chance using a Qt UWP (Universal Windows Platform aka WinRT) version?

                        If yes, do you really need that, or do you want to build classic Windows applications? In that case, use a Qt version without UWP.

                        Regards

                        Qt has to stay free or it will die.

                        1 Reply Last reply
                        1
                        • A Offline
                          A Offline
                          Abdulmueez
                          wrote on last edited by
                          #12

                          Yes, I am using a qt uwp version as it is the only version I have on my system that is X86, Let me try and get the version without uwp and see

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            Abdulmueez
                            wrote on last edited by Abdulmueez
                            #13

                            Pheew I have finally been able to install it, I probably should detail how I overcame most of the errors I came across while trying to install it.

                            1. Using zlib: after downloading the file from their official website,
                              then go to the folder from cmd
                            mkdir build
                            cd build
                             cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:
                            
                            1. Couldn't find bzip2, to correct this, install the bzip2 directly from the website, It installs in programfiles x86, then point bzip to it from the cmake gui, this corrects the error.
                            2. From Karchive, to build or install it, after running the instructions as detailed in the guide, I ran into an error
                            error C2061: syntax error: identifier 'mode_t'
                            

                            to overcome this, I opened the cmake gui and changed the directory of every qt file from mingw to msvc, Ensure that you are using an msvc of 32 bit and not win_rt to avoid complications in the future., then rerun the instructions as in the guide i.e

                            cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:-DCMAKE_BUILD_TYPE=release -DCMAKE_PREFIX_PATH=C:;C:5.2.0\5.2.0\msvc2017;C:;C:2
                            
                            nmake install
                            

                            This got the job done for me, hope it helps someone out too.
                            Thanks to everyone who helped out.

                            1 Reply Last reply
                            2

                            • Login

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