Build a Visual Studio 2013 project in pure C

2020-02-11 08:24发布

What is the best way to do this? The templates seem to allow only for C++ (which is basically compatible with C, but not the same.) What is the proper way to do this? (A particular #define or whatever.) Any help would be appreciated.

1条回答
劫难
2楼-- · 2020-02-11 08:44

The solution is simple and easy

  1. You create a new win32 console project

  2. Remove the default .cpp file

  3. Add new .c file as you wish

  4. In Properties, under C/C++ --> All Options, find "Compile as", then select "Compile as C code"

two muppets

  1. Simple sanity check. This code doesn't work with C++ since "new" is a reserved word for C++.

    int new = 10;

查看更多
登录 后发表回答