linux C下struct定义类的error:“unknown type name"

今天本来已经把其他输出输入输出的地方调通了,但是遇到了这个问题,无论我这个定义的struct是在.c文件的上面,或者是被包含的.h文件中,都显示error:“unknown type name"

struct _ksw_data
{
	int * qlen;
	uint8_t *query;
	int * tlen;
	uint8_t * target;
	int m;
	int8_t *mat;
	int o_del;
	int e_del;
	int o_ins;
	int e_ins;
	int w;
	int end_bonus;
	int zdrop;
	int h0;
	//output
	//int *_qle, int *_tle, int *_gtle, int *_gscore, int *_max_off
	int _qle;
	int _tle;
	int _gtle;
	int _gscore;
	int _max_off;
	//ret value;
	int ret;
};
int main(void) {
kswdata *inp_data;
}

后来分析得知,这种直接用gcc编译的代码,无法直接将kswdata认为成一个类。
解决办法:
在kswdata前面加上struct即可。
正确代码

猜你喜欢

转载自blog.csdn.net/qq_39499621/article/details/85231475