Solved Using qplatformdefs.h on windows
-
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 problemserror 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?
-
@abdulmueez What exact Qt version do you use and what exact compiler version?
-
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?
-
@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?
-
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? -
@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.
-
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
-
@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...
-
Alright, I think I get it now, I will try it out and check back. Thanks a lot for your help
-
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 errorqtmaind.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
-
@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
-
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
-
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.
- 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:
- 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.
- 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. - Using zlib: after downloading the file from their official website,