小编Leb*_*nen的帖子

使用complex.h库在Visual Studio 2013中编译C代码

http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx

C99支持添加了visual studio 2013,但我无法在我的"C"代码中使用complex.h.

#include <stdio.h>
#include <complex.h>
int main(void)
{
    double complex dc1 = 3 + 2 * I;
    double complex dc2 = 4 + 5 * I;
    double complex result;

    result = dc1 + dc2;
    printf(" ??? \n", result);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我得到语法错误.

编辑:抱歉缺少部分.

error C2146: syntax error : missing ';' before identifier 'dc1'
error C2065: 'dc1' : undeclared identifier
error C2088: '*' : illegal for struct
error C2086: 'double complex' : redefinition
error C2146: syntax error : …
Run Code Online (Sandbox Code Playgroud)

c complex-numbers visual-studio visual-studio-2013

9
推荐指数
1
解决办法
4394
查看次数