显示的错误是:
error LNK2001: unresolved external symbol "void __cdecl gerarPadroesTeste(double * const,double,int (* const)[31])" (?gerarPadroesTeste@@YAXQANNQAY0BP@H@Z)
我当前的头文件:
#define K 16
#define NR_PONTOS 9
#define NR_REP_TOTAL 100000
#define theta 0.50
#define tau 16
#define beta 6
int unif();
int somaMod2(int a, int b);
double gaussiana(double m, double sd);
double calcularPi(double zi, double variancia, bool computeBeta);
void gerarResultados(double snrdb, double ber, double wer, int nerrb, int nerrw, char* s);
void read_p();
void generate_gf();
void gen_poly();
void encode_bch(int u[], int rd[]);
void unirPalavraCodigo(int u[], int rd[], int c[]);
void decode_bch(int y[]);
void canalAWGN(double x[], double r[], double sd);
void chase(double r[N], int y[N], double variancia, int z[K]);
void gerarPadroesTeste(double r[N], double variancia, int pTeste[][N]);
double distanciaEuclidiana(double r[], int y[]);
void modularBPSK(int c[], double x[], double e);
void demodularBPSK(double r[], int y[]);
int pesoHamming(int a[]);
bool isValid(int yt[]);
double modulo(double n);
我的.cpp文件具有所有方法的实现。我将在这里复制调用失败方法和方法本身的方法:
void gerarPadroesTeste(int r[N], double variancia, int pTeste[][N])
{
double p[N];
double aux;
for (int a = 0; a < N; a++){
double mr = -modulo(r[a]);
aux = calcularPi(mr, variancia, false);
if (aux <= 0.5 - theta)
p[a] = 0;
else if (aux >= 0.5 + theta)
p[a] = 1;
else
p[a] = calcularPi(mr, variancia, true);
}
for (int b = 0; b < tau; b++){
for (int c = 0; c < N; c++){
double k = rand();
if (k/RAND_MAX <= p[c])
pTeste[b][c] = 0;
else
pTeste[b][c] = 1;
}
}
}
void chase(double r[N], int y[N], double variancia, int z[K])
{
int pTeste[tau][N];
gerarPadroesTeste(r, variancia, pTeste);
int i,j,m;
int yt[N];
int lambda[tau][N];
for (i = 0; i < tau; i++){
for (j = 0; j < N; j++){
lambda[i][j] = -1;
}
}
bool valido;
for (i = 0; i < tau; i++){
for (j = 0; j < N; j++){
yt[j] = somaMod2(y[j],pTeste[i][j]);
}
decode_bch(yt);
valido = isValid(yt);
if (valido) {
for (j = 0; j < N; j++){
lambda[i][j] = yt[j];
}
}
}
double minimo = 10000;
for (i = 0; i < tau; i++){
if (lambda[i][0] == -1)
continue;
else{
for (j = 0; j < N; j++){
yt[j] = lambda[i][j];
}
if (distanciaEuclidiana(r,yt) < minimo){
minimo = distanciaEuclidiana(r,yt);
for (m = 0; m < K; m++){
z[m] = yt[m+length-K];
}
}
}
}
}
答案 0 :(得分:2)
在你的标题中声明了
void gerarPadroesTeste(double r[N], double variancia, int pTeste[][N]);
但在你的cpp中定义了
void gerarPadroesTeste(int r[N], double variancia, int pTeste[][N])
因此,第一个参数double [N]的版本定义仍然缺失。