我在編譯程序時遇到了一些麻煩,現在我認爲現在大部分問題都是我一直在尋找它太久......該計劃的這一一個部分編譯錯誤C2059,C2061,C2146和偶發性智能感知錯誤
概述:你有長方形,你要轉換到極座標形式複數(由結構「情結」表示)的複數(由代表結構「pComplex」)
試圖建立時,我得到這些錯誤,每三次:
"error C2059: syntax error: ')'"
"error C2059: syntax error: ';'"
"error C2061: syntax error: identifier 'c1'"
"error C2146: syntax error: missing ')' before identifier 'c1'"
此外,我收到IntelliSense: identifier "Complex" is undefined
,但只有直到點擊有問題的線路,然後它消失。
所有錯誤指向相同的頭文件的同一行(pcomplex.h
):的pcomplex.h
pComplex NF_convert_c2_pcdouble(Complex c1);
相關部分:
#ifndef PCOMPLEX_H
#define PCOMPLEX_H
#include "complex.h"
#include <math.h>
//
// ...
//
typedef struct nf_complex_polar{
double r;
double angle;
} pComplex;
//
// ...
//
pComplex NF_convert_c2_pcdouble(Complex c1);
//
// ...
//
#endif
的complex.h
相關部分:
#ifndef COMPLEX_H
#define COMPLEX_H
#include "pcomplex.h"
#include <math.h>
//
// ...
//
typedef struct nf_complex{
double real;
double imag;
} Complex;
//
// ...
//
Complex NF_convert_pc2_cdouble(pComplex pc1);
//
// ...
//
#endif
我注意到,當我懸停ov呃函數名在pcomplex.c
,
pComplex NF_convert_c2_pcdouble(Complex c1)
{
//This function converts a rectangular form complex number c1
// and returns it as a polar form complex number pc1
pComplex pc1;
double x, y, r, a;
x = c1.real;
y = c1.imag;
r = sqrt(x*x + y*y);
a = atan2(y,x);
pc1.r = r;
pc1.angle = a;
return pc1;
}
我得到這個包含一個小彈出框,我不知道是什麼,第二行表示:
pComplex NF_convert_c2_pcdouble(Complex c1)
pComplex NF_convert_c2_pcdouble(<error-type> c1)
這是足夠的信息和代碼的優點尋求幫助來搞清楚這一點?兩個頭文件大約每行100行,相應的源文件大約有1000行...所以我試圖保持它的相關性。
請標記功課 – 2012-01-08 08:25:00