locked
CreateSemaphoreEx identifier not found

    Question

  • Hi,

    I'm porting our engine to windows store, I'm getting the error 'CreateSemaphoreEx': identifier not found. I'm using command line options /DWINAPI_FAMILY=WINAPI_FAMILY_APP and /ZW for the compiler, and including <windows.h>. Do I need to include anything else? The documentation I found ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms682446(v=vs.85).aspx ) says Windows Phone 8.1 is supported, I assume it's the same for Store apps with the whole "unified" apis?

    Thanks.


    • Edited by pete275 Monday, September 15, 2014 5:22 AM
    Monday, September 15, 2014 4:17 AM

All replies

  • I just created a new universal app and tried this, with no problems.  Can you post your code that uses CreateSemiphoneEx?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, September 15, 2014 12:19 PM
    Moderator
  • Are you using the Visual Studio IDE build environment (MS Build) or something custom?

    If you are doing a custom build, you need to make sure you set either /D_WIN32_WINNT=0x0602 for Windows 8 or Windows Phone 8, or /D_WIN32_WINNT=0x0603 for Windows 8.1 or Windows Phone 8.1. See Using the Windows Headers and the blog post Dual-use Coding Techniques for Games.

    This is also assuming you are using Visual Studio 2013 and the updated Windows 8.1 SDK (April 2014) that comes with VS 2013 Update 3.
    Monday, September 15, 2014 6:59 PM
  • Thanks for the replies.

    I'm using something custom, scons from the "VS2012 x64 Cross Tools Command Prompt", so I can't provide code with a VS project, sorry (I don't even know what a XAML is, I'm hoping I will get an .exe that I can run on my Surface or maybe package it somehow and deploy to a device?). 

    I have installed "Microsoft Visual Studio Express 2013 for Windows" version 12.0.30723.00 Update 3, downloaded a couple of months ago.

    I added /D_WIN32_WINNT=0x0603, but I still get the same error. I also tried /DNTDDI_VERSION=0x06030000, same result. Here's the complete command I'm running:

    cl /Fodrivers\windows\semaphore_windows.rt.obj /c drivers\windows\semaphore_windows.cpp /TP /TP /nologo /Zi /DDEBUG_ENABLED /DD3D_DEBUG_INFO /O1 /Gd /GR /nologo /ZW /EHsc /DWINRT_ENABLED /DWINDOWS_ENABLED /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D_WIN32_WINNT=0x0603 /DMSVC /GR /I. /Iplatform\winrt /Iplatform\winrt\include 

    And the code I'm trying to compile is just this:

    #include <windows.h> [...] SemaphoreWindows::SemaphoreWindows() { semaphore=CreateSemaphoreEx( NULL, 0, 0xFFFFFFF, NULL, 0, SEMAPHORE_ALL_ACCESS); }

    Thanks.

    PS: please ignore the formatting, I don't know how to use this thing :p
    • Edited by pete275 Tuesday, September 16, 2014 4:41 AM weird paste behavior
    Tuesday, September 16, 2014 4:40 AM