Results 1 to 16 of 16

Thread: cannot compile Windows Platform SDK code with QtCreator and mingw

  1. #1
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default cannot compile Windows Platform SDK code with QtCreator and mingw

    I have quite simple task to compile working code for bluetooth socket.

    I have:
    QtCreator 4.7.0, mingw, Windows Platform SDK 2003, - WindowsXP

    The code for Bluetooth API strarting with:
    Qt Code:
    1. #include <bthsdpdef.h>
    2. #include <BluetoothAPIs.h>
    3. #include <winsock2.h>
    4. #include <ws2bth.h>
    5.  
    6. void Run( )
    7. {
    8. WORD wVersionRequested = 0x202;
    9. WSADATA m_data;
    10. if (0 == ::WSAStartup(wVersionRequested, &m_data))
    11. {
    12. SOCKET s = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
    13. const DWORD lastError = ::GetLastError();
    14. if (s == INVALID_SOCKET)
    15. {
    16. ....
    17. etc...
    To copy to clipboard, switch view to plain text mode 

    In .pro file I'm writing:
    Qt Code:
    1. INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include"
    To copy to clipboard, switch view to plain text mode 

    Error:
    ..\..\Program Files\Microsoft Platform SDK\Include/winnt.h:666:2: error: #error Must define a target architecture.
    ..\..\Program Files\Microsoft Platform SDK\Include/bthsdpdef.h:16: error: 'ULONGLONG' does not name a type
    ..\..\Program Files\Microsoft Platform SDK\Include/bthsdpdef.h:29: error: 'USHORT' does not name a type
    ... etc 500 errors..

    Adding to .pro file extra include folder:
    Qt Code:
    1. INCLUDEPATH += "C:\\Program Files\\Microsoft Platform SDK\\Include" "C:\\Program Files\\Microsoft Platform SDK\\Include\\crt"
    To copy to clipboard, switch view to plain text mode 

    Then I'm getting another erros:
    ..\..\Program Files\Microsoft Platform SDK\Include\crt/stddef.h:119: error: redeclaration of C++ built-in type 'wchar_t'
    ..\..\Program Files\Microsoft Platform SDK\Include\crt/stdlib.h:258: error: expected constructor, destructor, or type conversion before '_abs64'
    ..\..\Program Files\Microsoft Platform SDK\Include\crt/stdlib.h:267: error: expected initializer before '_byteswap_uint64'
    ... etc.. 500 other similar erros

    The question:
    How to compile 3rd party (windows api) stuff with QtCreator and mingw compiler?
    Am I missing something? Is it possible with mingw at all or better to use msvc compiler?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Qt Creator has nothing to do with the subject, it's just a text editor. If you get an error from the compiler then the first thing I would do would be to look into the place where the error happens. Adding or removing include directories will not change anything. This question belongs more to the MinGW forum and not here, maybe you need to include different files that come with MinGW instead of the ones provided by Microsoft.

    By the way, the last version of Qt Creator I know of is 2.0.1, 4.7.0 is the version of Qt.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    thank you for quick response even it wasnt so informative.
    the BluetoothAPIs.h has nothing to do with files wich comes with mingw, its pure Win Platform SDK thing. Unfortunatelly Qt library has no support for bluetooth functionality neither. So I have to use some 3rd party libs for that.

    Do you personaly have any experience with including Microsoft Platform SDK\Include headers to qt project and building it with mingw?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by kompotFX View Post
    the BluetoothAPIs.h has nothing to do with files wich comes with mingw,
    If it includes some standard header for which MinGW provides its own version then files that come with MinGW have lots to do with that.

    Unfortunatelly Qt library has no support for bluetooth functionality neither.
    Actually as far as I know it does in QtMobility 1.1. But I might be wrong or it might not support the functionality you need.

    Do you personaly have any experience with including Microsoft Platform SDK\Include headers to qt project and building it with mingw?
    I personally have experience that MinGW has its own runtime which is incompatible with the runtime for MSVC and some files that replace the ones for MSVC which is what Microsoft provides. I don't know if your issue is related to that, I only say it might be. What you can try is to build your test application with bare MinGW (without using Qt Creator, Qt or qmake) but this requires some knowledge about building applications from the command line which is uncommon for people used to doing everything with a button click in Visual Studio. If you have such knowledge then it might be the time to use it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    QtMobility I guess targeted only for Symbian and Maemo stuff.

    If it includes some standard header for which MinGW provides its own version then files that come with MinGW have lots to do with that.
    exactly. there are conflicts between headers from platform sdk and mingw.
    and I cannot see any solution so far how to use mingw compiler here. The easiest way to switch to msvc. I just wanted to use QtCreator ("editor" as u says) instead of Visual Studio "editor". Unfortunatelly its "glued" to mingw, so there is no other choice.

    Thanks for trying to help me.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Incorrect. 'mingw' is not 'glued' to QtCreator at all, you can use whichever compiler you prefer. Have a look at the makefiles.

  7. #7
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    And also you can use Qt with the Visual Studio (IDE and VC++ compiler)

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by kompotFX View Post
    QtMobility I guess targeted only for Symbian and Maemo stuff.
    No, that's not true.

    and I cannot see any solution so far how to use mingw compiler here.
    So why don't you go to a MinGW forum and ask there?

    The easiest way to switch to msvc. I just wanted to use QtCreator ("editor" as u says) instead of Visual Studio "editor". Unfortunatelly its "glued" to mingw, so there is no other choice.
    As already said it is not glued to anything. It supports everything qmake or cmake support, msvc included.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    As already said it is not glued to anything. It supports everything qmake or cmake support, msvc included.
    in build settings the Tool chain filed is MinGW and its grey colour not editable. How to change it?

    Quote Originally Posted by Zlatomir View Post
    And also you can use Qt with the Visual Studio (IDE and VC++ compiler)
    thats what I meant by saying "and I cannot see any solution so far how to use mingw compiler here. The easiest way to switch to msvc. "

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by kompotFX View Post
    in build settings the Tool chain filed is MinGW and its grey colour not editable. How to change it?
    If you want to use Qt then you have to have Qt built for MSVC (either from binary if available or built yourself). Then qmake should already be set up for MSVC. If you don't need Qt then you need to tell qmake to use the proper specs (win32-msvc<something>) by adjusting the build steps (you need to pass a -specs parameter with appropriate argument).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by wysota View Post
    If you want to use Qt then you have to have Qt built for MSVC (either from binary if available or built yourself). Then qmake should already be set up for MSVC. If you don't need Qt then you need to tell qmake to use the proper specs (win32-msvc<something>) by adjusting the build steps (you need to pass a -specs parameter with appropriate argument).
    I have installed both:
    Qt libraries 4.7.0 for Windows (VS 2008, 226 MB)
    Qt SDK for Windows* (322 MB) - this comes with QtCreator and mingw
    (*Based on MinGW (download sources) tool set. Does not support VS compiler.)

    In QtCreator I open Tools - Options - Qt4 - Qt versions tab.
    There is c:\qt\2010.05\qt\bin\qmake.exe as autodetected version (which is Qt SDK for Windows installation).
    When I try to add 4.7.0 qmake for VS2008 it is message in bottom of settings window telling me "Qt version is not properly installed, please run make install". However Qt library 4.7.0 for Windows is properly installed and I able to build current project using Visual Studio without any problems. What should I do to make it recognisable by QtCreator? I just guess it is LGPL license restrictions not to use msvc stuff in QtCreator. Or am I wrong?

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    The licence has nothing to do with it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by wysota
    As already said it is not glued to anything. It supports everything qmake or cmake support, msvc included.
    Quote Originally Posted by wysota
    If you want to use Qt then you have to have Qt built for MSVC (either from binary if available or built yourself). Then qmake should already be set up for MSVC. If you don't need Qt then you need to tell qmake to use the proper specs (win32-msvc<something>) by adjusting the build steps (you need to pass a -specs parameter with appropriate argument).
    Quote Originally Posted by wysota View Post
    The licence has nothing to do with it.
    Actually I dont care so much about if it is license or something else to do with it. You are telling me that QtCreator not glued to mingw, so logically I assume it is possible to setup it to use Qt built for msvc and trigger msvc compiler to build the code etc..
    Can you tell me exactly, how to do this? Step-by-step if it is possible or at least be more speciffic?

  14. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    I can try (although I've never done it myself) but please tell me what is unclear in what I explained in post #10. Did you find where to adjust the build steps in Creator?

    I can tell you the simplest way to do it is to run Qt Creator when qmake built for Visual Studio is the first qmake in the PATH - then you shouldn't need to adjust anything - Creator should pick up the appropriate configuration itself. At least it was so for one of the previous versions of Creator but I suspect nothing has changed in this regard.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #15
    Join Date
    Jan 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    Quote Originally Posted by wysota View Post
    I can try (although I've never done it myself) but please tell me what is unclear in what I explained in post #10. Did you find where to adjust the build steps in Creator?

    I can tell you the simplest way to do it is to run Qt Creator when qmake built for Visual Studio is the first qmake in the PATH - then you shouldn't need to adjust anything - Creator should pick up the appropriate configuration itself. At least it was so for one of the previous versions of Creator but I suspect nothing has changed in this regard.
    I can repeat step by step what I do:
    I have installed both:
    Qt libraries 4.7.0 for Windows (VS 2008, 226 MB)
    Qt SDK for Windows* (322 MB) - this comes with QtCreator and mingw
    (*Based on MinGW (download sources) tool set. Does not support VS compiler.)

    In QtCreator I open Tools - Options - Qt4 - Qt versions tab.
    There is c:\qt\2010.05\qt\bin\qmake.exe as autodetected version (which is Qt SDK for Windows installation).
    When I try to add 4.7.0 qmake for VS2008 it is message in bottom of settings window telling me "Qt version is not properly installed, please run make install". However Qt library 4.7.0 for Windows is properly installed and I able to build current project using Visual Studio without any problems. What should I do to make it recognisable by QtCreator?
    Do you have QtCreator in front of you? Windows? Have Qt libraries 4.7.0 for Windows (VS 2008, 226 MB) installed? Than probably it should be not problem for you to explain which settigng window I have to open and what to write/select there.

  16. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: cannot compile Windows Platform SDK code with QtCreator and mingw

    No, I don't have Windows in front of me now and I'm using a slightly newer version of Creator than you do but this shouldn't be a problem. Open your project and switch to the "projects" pane where you will find the build settings and build steps. The first build step is the qmake step which you need to adjust by passing a different argument (win32-msvc2008) to the -spec parameter. Then try building the project. If that doesn't work then close Qt Creator, launch "Qt command prompt" for the MSVC-enabled version of Qt and launch Creator from this commandline. Then make sure the Qt versions tab has a "Qt in PATH" entry pointing to your Qt installation and build the project.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 11th August 2011, 09:02
  2. using GLUT along with qtcreator/mingw in windows
    By stephanepoirier in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2009, 06:26
  3. Shadow build QT for the win32-g++ (MinGw) platform.
    By Avrohom in forum Installation and Deployment
    Replies: 0
    Last Post: 21st January 2009, 00:10
  4. Replies: 4
    Last Post: 29th December 2007, 02:27
  5. Cross compile QT/X11 for platform xscale-elf
    By nmkarvekar in forum Installation and Deployment
    Replies: 0
    Last Post: 19th May 2006, 08:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.