C++ debug 报错问题 fatal error LNK1120
高手帮忙看看:
test_f.h 文件
#ifndef _H_H
#define _H_H
extern int k;//k为偏移量数组中的计数变量
extern int in_tab[9999]={0};
extern float coef_tab[9999]={0};
extern float out_tab[9999]={0};
extern int io[256];
extern int co[256];
extern int oo[256];
extern void init_alg(char *p_buf);
extern int two_one(char a,char b);
extern struct rbn
{
int blk_num;//block number
int fun_num;//function code number
int MFP;//MFP number
int seq_blk;// initial sequence
int in_num;//input number
int coef_num;// coeffcient number
int out_num;// output number
int *in_offet;//input offset
float *coef_offet;//coeffcient offset
float *out_offet;//output offset
int *in;
float *coef;
float *out;
float dt;//compute periods
}init_rbn[10000];
#endif
test_f.cpp文件
#include <stdlib.h>
#include <stdio.h>
#include "test_f.h"
#include "math.h"
#include <iostream.h>
int two_one(char a,char b)
{
int blk_n;
blk_n = ((unsigned char)a <<8)|(unsigned char)b;
return(blk_n);
}
int io[256]={0,1,0,2,2,1,1,1,2,3,4,
4,1,3,4,2,2,2,3,4,3,
6,6,6,1,0,0
};
int co[256]={0,12,1,2,4,2,2,1,2,2,0,
0, 2,0,0,2,1,1,7,8,1,
10,10,10,2,2,3
};
int oo[256]={0,1,1,1,2,1,1,1,1,1,1,
1,2,1,1,1,1,1,1,1,1,
6,6,6,1,1
};
void init_alg(char *p_buf)
{
init_rbn[0].in_offet=&in_tab[0];
init_rbn[0].coef_offet=&coef_tab[0];
init_rbn[0].out_offet=&out_tab[0];
init_rbn[k].blk_num=two_one(p_buf[28],p_buf[29]);
}
int main()
{
int *p=&in_tab[0];
printf("*p=\n",*p);
return 0;
}
Configuration: test_f - Win32 Debug--------------------
Compiling...
test_f.cpp
Linking...
test_f.obj : error LNK2001: unresolved external symbol "int k" (?k@@3HA)
test_f.obj : error LNK2001: unresolved external symbol "struct rbn * init_rbn" (?init_rbn@@3PAUrbn@@A)
Debug/test_f.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
test_f.exe - 3 error(s), 0 warning(s)
在线等
test_f.h 文件
#ifndef _H_H
#define _H_H
extern int k;//k为偏移量数组中的计数变量
extern int in_tab[9999]={0};
extern float coef_tab[9999]={0};
extern float out_tab[9999]={0};
extern int io[256];
extern int co[256];
extern int oo[256];
extern void init_alg(char *p_buf);
extern int two_one(char a,char b);
extern struct rbn
{
int blk_num;//block number
int fun_num;//function code number
int MFP;//MFP number
int seq_blk;// initial sequence
int in_num;//input number
int coef_num;// coeffcient number
int out_num;// output number
int *in_offet;//input offset
float *coef_offet;//coeffcient offset
float *out_offet;//output offset
int *in;
float *coef;
float *out;
float dt;//compute periods
}init_rbn[10000];
#endif
test_f.cpp文件
#include <stdlib.h>
#include <stdio.h>
#include "test_f.h"
#include "math.h"
#include <iostream.h>
int two_one(char a,char b)
{
int blk_n;
blk_n = ((unsigned char)a <<8)|(unsigned char)b;
return(blk_n);
}
int io[256]={0,1,0,2,2,1,1,1,2,3,4,
4,1,3,4,2,2,2,3,4,3,
6,6,6,1,0,0
};
int co[256]={0,12,1,2,4,2,2,1,2,2,0,
0, 2,0,0,2,1,1,7,8,1,
10,10,10,2,2,3
};
int oo[256]={0,1,1,1,2,1,1,1,1,1,1,
1,2,1,1,1,1,1,1,1,1,
6,6,6,1,1
};
void init_alg(char *p_buf)
{
init_rbn[0].in_offet=&in_tab[0];
init_rbn[0].coef_offet=&coef_tab[0];
init_rbn[0].out_offet=&out_tab[0];
init_rbn[k].blk_num=two_one(p_buf[28],p_buf[29]);
}
int main()
{
int *p=&in_tab[0];
printf("*p=\n",*p);
return 0;
}
Configuration: test_f - Win32 Debug--------------------
Compiling...
test_f.cpp
Linking...
test_f.obj : error LNK2001: unresolved external symbol "int k" (?k@@3HA)
test_f.obj : error LNK2001: unresolved external symbol "struct rbn * init_rbn" (?init_rbn@@3PAUrbn@@A)
Debug/test_f.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
test_f.exe - 3 error(s), 0 warning(s)
在线等
...全文
相关推荐
C++常见错误及解决方案
错误提示中还包括了出错文件的路径:`D:\c++项目\3.11.2.4\Debug\3.11.2.4.exe : fatal error LNK1120: 1个无法解析的外部命令`。
vc中error LNK2001 resolved external symbol _WinMain@16的解决方法
### vc中error LNK2001 resolved external symbol _WinMain@16的解决方法#### 一、问题描述在使用Visual C++ (VC) 编译C++项目时,
最常见的VC++编译错误信息_fatal_error
LINK : fatal error LNK1168:cannot open Debug/P1.exe for writing这是一个常见的连接错误,原因是不能打开P1.exe文件,以改写内容。
C和C++混合编程问题
sum@@YAHHH@Z)E:\Programming\Grapic\test\Debug\test.exe:fatal error LNK1120: 1个无法解析的外部命令```这表明链接器找不到由`
C++常见错误汇总
LINK : fatal error LNK1168: cannot open Debug/P1.exe for writing这个错误是连接错误:不能打开 P1.exe 文件,以改写内容。


