gpt4 book ai didi

c++ - VS C++ - 错误 LNK2001 : unresolved external symbol

转载 作者:行者123 更新时间:2023-11-30 04:08:43 26 4
gpt4 key购买 nike

显示的错误是:

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];
}
}
}
}
}

最佳答案

在您声明的 header 中

void gerarPadroesTeste(double r[N], double variancia, int pTeste[][N]);

但是在你的cpp中你定义了

void gerarPadroesTeste(int r[N], double variancia, int pTeste[][N])

所以第一个参数double[N]的version的定义还是少了。

关于c++ - VS C++ - 错误 LNK2001 : unresolved external symbol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21686096/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com