locked
Is there a list of standard C++ library headers supported for Metro apps?

All replies

  •  

    Hello,

     

    There is document about C++ 11 features supported in native C++

    http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx

     

    But in metro, the way of accessing file system and concurrency programming is different than before.

     

    I would suggest you to use these namespace in metro.

    Windows.Storage namespace

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.aspx

    And Concurrency Namespace

    http://msdn.microsoft.com/en-us/library/dd492819.aspx

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 31, 2012 7:15 AM
  • Thanks for the link - as for the standard C++ lib, I think that all are supported, only stuff that is not marked with the partition app macros are not allowed (see headers).  File system is in, because if you look at the C lib, you see fopen is also allowed, so I assume nothing wrong with <filesystem>
    Thursday, May 31, 2012 11:33 AM
  • Looks like a duplicate of Are there any restrictions of using C Runtime library in Metro Style apps or WinRT DLL


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP

    Thursday, May 31, 2012 2:39 PM
  • What do the partition app macros look like? I don't see anything indicating metro/desktop (like the #pragma region XXXX Family stuff in the win32 SDK headers).
    Thursday, May 31, 2012 4:35 PM
  • It is similar, but the c runtime library and standard c++ library are different (though they are sometimes used interchangably). I didn't notice that thread because I assumed it was fopen() type stuff.
    Thursday, May 31, 2012 4:37 PM
  • you can search the headers for this define:

    _CRT_USE_WINAPI_FAMILY_DESKTOP_APP


    Thursday, May 31, 2012 6:50 PM
  • And for the Windows APIs, there is a new header file, winapifamily.h, that contains partition defines WINAPI_PARTITION_DESKTOP (for all Win32 apps) and WINAPI_PARTITION_APP (for Metro style apps).  These partitions get set when you set WINAPI_FAMILY to WINAPI_FAMILY_APP or WINAPI_FAMILY_DESKTOP_APP. 

    Generally, you don't need to include winapifamily.h explicitly in your code because it is included by windows.h.  Furthermore, the Visual Studio project templates automatically set the these defines for you; if you go into the project settings -> C++ settings -> Preprocessor -> Preprocessor Definitions, you will see that the Metro style projects set WINAPI_FAMILY = WINAPI_FAMILY_APP for you.  Then, VC++ IntelliSense will red-underline stuff that isn't defined in the selected API family.

    Sincerely,

    Dan Ruder [MSFT]


    Friday, June 01, 2012 5:46 PM
    Moderator
  • The CRT partitions are defined in crtdefs.h.  Note that crtdefs.h will define/undefine _CRT_USE_WINAPI_FAMILY_DESKTOP_APP according to how WINAPI_FAMILY (from winapifamily.h) is defined.  Then, _CRT_BUILD_DESKTOP_APP gets defined based on _CRT_USE_WINAPI_FAMILY_DESKTOP_APP.

    Therefore, if you set WINAPI_FAMILY = WINAPI_FAMILY_APP or WINAPI_FAMILY_DESKTOP_APP, you automatically get the CRT defines set correctly.  If you don't define WINAPI_FAMILY, then the default is to set the CRT defines for desktop apps builds.  So, you shouldn't have to explicitly set the CRT defines yourself.

    Sincerely,

    Dan Ruder [MSFT]

    Friday, June 01, 2012 6:09 PM
    Moderator