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

Can I use 'Windows Template Library' in Mac qt project



  • Hi:
    I developed a project in Mac Qt which transplanted from windows qt, in my project,it shows error:
    use of undeclared identifier 'wglGetCurrentContext' , and I know 'wglGetCurrentContext' method belong to the GDI API which in windows platform.
    I search in my mac, and I found the 'wglGetCurrentContext' method in the atlapp.h which path is '/Users/lee/Qt5.11.3/5.11.3/Src/qtwebengine/src/3rdparty/chromium/third_party/wtl/include/atlapp.h' in Qt directory, in the top of atlapp.h file I found the statements:

    // Windows Template Library - WTL version 8.0
    // Copyright (C) Microsoft Corporation. All rights reserved.
    //
    // This file is a part of the Windows Template Library.
    // The use and distribution terms for this software are covered by the
    // Microsoft Permissive License (Ms-PL) which can be found in the file
    // Ms-PL.txt at the root of this distribution.

    so I know the atlapp.h is a part of Windows Template Library, now I have a question :
    can I use the Windows Template Library in my mac qt project for develope a mac app?


  • Lifetime Qt Champion

    Hi,

    AFAIK, no, it's only for Windows.

    Out of curiosity, why would you use WTL since you are currently using Qt for it's cross-platform capabilities.



  • @SGaist
    thanks for your reply!

    I am a new employee of the company, taking over projects from colleagues who develop windows, the company let me develop the project for mac paltform base on the windows qt project.

    is there any website teaches us how to develop from windows porting project to mac?


  • Lifetime Qt Champion

    Since you are using Qt, you already have at least the GUI which is cross-platform. Therefore, what part of the application exactly do you think needs porting ?



  • @SGaist

    thanks a lot!

    I am a new employee of the company, taking over projects from colleagues who develop windows, the company let me develop the project for mac platform base on the windows qt project. but the the windows qt project had include the <windows.h>,
    now I had to fix it on mac, it is not easy, so I ask for any website teaches us how to develop from windows porting project to mac.


  • Lifetime Qt Champion

    @Princein said in Can I use 'Windows Template Library' in Mac qt project:

    so I ask for any website teaches us how to develop from windows porting project to mac.

    The first thing to find out, is why he included windows.h, i.e. which Windows API is used and for what (and if that is still needed).

    Once you know that, you can look if you can use Qt for these functions, which would make it automatically cross-platform. If you cannot use Qt, then you have to re-write the code using macOS-API.

    There is not general rule to follow, it really depends which Windows API is used.

    Regards


Log in to reply