locked
vs 2012 when compile c code with <mutex> header file will report strange error

    Question

  • hi, first I am not sure here is right place to ask abort this question.So, if not please let me know,thx.

    yesterday , I want to compile some c codes and I know it is not possible to use Windows Runtime Componet Project(because of the Windows Runtime Extension),then I add a new project (VC++->Windows Metro Style->Static Library) to my solution, and I can compile them all, but when I just include <mutex> in one of them I got a lot of compile error, like this :

    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\thr\xtime(13): error C2061: syntax error : identifier 'stdext'
    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\thr\xtime(13): error C2059: syntax error : ';'

    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\thr\xtime(14): error C2449: found '{' at file scope (missing function header?)
    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\thr\xtime(21): error C2059: syntax error : '}'
    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtr1common(15): error C2143: syntax error : missing '{' before '<'
    1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtr1common(15): error C2059: syntax error : '<'

    so I thought there may be something wrong with the code , but I can not find out until now...

    today, I just start a new solution and add a c file with code like this

    #include <mutex>

    int main()
    {
     return 0;
    }

    and also I get the compile error too... can anybody tell me why?and what is wrong with the c code and STL.

    I’m on Windows 8 Release Preview (8400) and

    Microsoft Visual Studio Ultimate 2012 RC
    Version 11.0.50522.1 RCREL
    Microsoft .NET Framework
    Version 4.5.50501

    Installed Version: Ultimate

    Thursday, July 12, 2012 6:43 AM

Answers

  • ok, stl can not be used in c file / code.....
    • Marked as answer by ahzhe Thursday, July 12, 2012 7:48 AM
    Thursday, July 12, 2012 7:47 AM

All replies

  • ok, stl can not be used in c file / code.....
    • Marked as answer by ahzhe Thursday, July 12, 2012 7:48 AM
    Thursday, July 12, 2012 7:47 AM
  • Thanks for sharing the solution.

     

    Best regards,

    Jesse



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

    Friday, July 13, 2012 7:26 AM