DEV-C++怎么链接文件
有三个文件,第一个是头文件,声明了函数原型、定义了变量结构体等第二个是.c文件,定义了函数
第三个是要运行的.c文件,调用函数,显示结果
编译显示链接错误,怎么才能把两个.c文件链接起来。。
程序代码:
//names_st.h
#define SLEN 32
struct names_st{
char first[SLEN];
char last[SLEN];
};
void get_names(struct names_st *);
void show_names(const struct names_st*);
//names_st.c
#include<stdio.h>
#include "names_st.h"
void get_names(struct names_st*p)
{
int i;
printf("Please enter your first name:");
fgets(p->first,SLEN,stdin);
i=0;
while(p->first[i]!='\n'&&p->first[i]!='\0')
i++;
if(p->first[i]=='\n')
p->first[i]='\0';
else
while(getchar()!='\n')
continue;
printf("Please enter your last name:");
fgets(p->last,SLEN,stdin);
i=0;
while(p->last[i]!='\n'&&p->last[i]!='\0')
i++;
if(p->last[i]=='\n')
p->last[i]='\0';
else
while(getchar()!='\n')
continue;
}
void show_names(const struct names_st*p)
{
printf("%s %s\n",p->first,p->last);
}