简体   繁体   English

Win32控制台项目问题

[英]Win32 Console Project issue

I created a Win32 Console project (disabled "precompiled header" option) with my VS2010. 我用VS2010创建了一个Win32 Console项目(禁用“预编译头”选项)。

Then I filled the code as below 然后我按如下所示填充代码

#include <stdio.h>
int main (void) {
    double d = 0x0.3p10;
    printf ("%.f\n", d);
    return 0;
}

The compiler shows a syntax error on the line of double d = 0x0.3p10; 编译器在double d = 0x0.3p10;的行上显示语法错误double d = 0x0.3p10; .

: error C2059: syntax error : 'bad suffix on number'
: error C2143: syntax error : missing ';' before 'constant'
: error C2146: syntax error : missing ';' before identifier 'p10'
: error C2065: 'p10' : undeclared identifier

Is there something wrong on my project configuration? 我的项目配置有问题吗?

No. Microsoft Visual C++ doesn't support ISO C99. 否。MicrosoftVisual C ++不支持ISO C99。 Sorry. 抱歉。 There is no workaround except to use a different compiler. 除使用其他编译器外,没有其他解决方法。 See this question's accepted answer . 请参阅此问题的可接受答案

Alternatives: 备择方案:

  1. Clang which will work with the MSVC headers. 可以与MSVC标头一起使用的Clang I don't think there are binaries available for it yet though so unless you like compiling compilers... 我认为还没有可用的二进制文件,除非您喜欢编译编译器...
  2. mingw which comes with msys and a complete set of headers of its own for the w32api. mingw带有msys和w32api的一套完整的标头。
  3. Intel's Compiler Suite . 英特尔的编译器套件 This integrates with Visual Studio but is non-free. 它与Visual Studio集成在一起,但并非免费。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM