Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with windows.h and DWORD type



  • Hello,
    I'm new to Qt, and I need to use DWORD type for a project.
    To start I have added this line in my .pro : (this path corresponds to where the windows.h file is located)
    0_1552054010103_340a1cbe-6850-41a2-aa06-8b4757e7cdc3-image.png
    And I have included windows.h in my header file
    0_1552053878221_504082ef-1165-41ae-b707-1017692b306c-image.png

    But I still get this error in my header file (and in my source file) unknown type name DWORD :
    0_1552054323339_7835ef27-5e64-442c-bbd7-ac1de0d149ba-image.png

    If someone can help me pls


  • Moderators

    Hi @Damalo_02

    let me ask a few questions.

    1. Are you actually also using the mingw compiler kit for your application?
      Because there will be conflicts if you add the mingw windows.h to your include path and you're using MSVC compiler.

    2. you shouldn't need to add the include path to simply use windows.h. that should be done automatically. So why did you do it

    3. You have to do a complete rebuild of your project, when you change anything in your *pro file. -> Delete your build folder.


    Edit: fixed format



  • Yes I use mingw as compiler.

    Thanks a lot for your help, I solved the problem. I just installed Visual Studio 2017, created a new Qt project, and everything works fine now.


Log in to reply