用C语言做中介信息管理系统时的一个问题
用C做一个中介信息管理系统,还没把Search功能写好,但主函数都写好了,想先运行下看看是否出错。用的是VC++6。
首先,编译.OBJ时没有Error,但是有Warning.
warning C4013: 'clrscr' undefined; assuming extern returning int
warning C4013: 'textmode' undefined; assuming extern returning int
warning C4013: 'textbackground' undefined; assuming extern returning int
warning C4013: 'window' undefined; assuming extern returning int
warning C4013: 'gotoxy' undefined; assuming extern returning int
warning C4013: 'textcolor' undefined; assuming extern returning int
warning C4013: 'save1' undefined; assuming extern returning int
warning C4013: 'save2' undefined; assuming extern returning int
warning C4716: 'del1' : must return a value
warning C4716: 'del2' : must return a value
warning C4716: 'save1' : must return a value
warning C4716: 'save2' : must return a value
然后组建EXE,在link的时候出现
error LNK2001: unresolved external symbol _gotoxy
error LNK2001: unresolved external symbol _window
error LNK2001: unresolved external symbol _textbackground
error LNK2001: unresolved external symbol _textmode
error LNK2001: unresolved external symbol _clrscr
error LNK2001: unresolved external symbol _textcolor
Debug/ZHONGJIE.exe : fatal error LNK1120: 6 unresolved externals
网上先找过点资料,说是头文件要<conio.h>,但还是出错,希望各大侠帮忙小弟解决下,我先去写search的功能了~~。
最后附上我的源代码~~
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#define ESC 27
#define NULL0
#define LEN sizeof(struct applicant)
#define LENB sizeof(struct job)
#define L sizeof(info1)
#define LB sizeof(info2)
int n,k;
char filename1[10];
char filename2[10];
struct applicant
{
long anum;
char aname[10];
char id[18];
char cert[20];
char rqurjob[20];
struct applicant * next1;
}applcnt[60],info1;
struct job
{
long jnum;
char jname[20];
int need;
struct job * next2;
}jb[100],info2;
/*------------color--------------*/
color()
{
int x1=20,y1=5,x2=60,y2=40,i;
clrscr();
textmode(3);
textbackground(2);
window(x1,y1,x2,y2);
for(i=1;i<=21;i++)
{
gotoxy(1,i);cprintf(" ");}
}
/*-------------menu-----------*/
menu()
{
char c;
color(); textcolor(19); gotoxy(17,3);cprintf("MENU"); textcolor(4);
gotoxy(9,5);cprintf("1 --input applicant record");
gotoxy(9,6);cprintf("2 --output applicant record");
gotoxy(9,7);cprintf("3 --delete applicant record");
gotoxy(9,8);cprintf("4 --insert applicant record");
gotoxy(9,9);cprintf("5 --search applicant record");
gotoxy(9,10);cprintf("6 --open applicant record");
gotoxy(9,11);cprintf("7 --input job record");
gotoxy(9,12);cprintf("8 --output job record");
gotoxy(9,13);cprintf("9 --delete job record");
gotoxy(9,14);cprintf("10 --search jobe record");
gotoxy(9,17);cprintf("0 --exit");
gotoxy(15,20);cprintf("Please Select:");
c=getch();
if(ESC==c)exit(0);
return(c);
}
/*---------------create applicant information---------------*/
struct applicant * create1(void)
{
struct applicant * p1, * p2; struct applicant * head1;
struct applicant * load1(void);
struct applicant * arrange1(struct applicant * head1);
char c;
color();
n=0;
p1=p2=(struct applicant * )malloc(LEN);
textcolor(14);
gotoxy(7,3);cprintf("Please Enter Record:");
textcolor(1);
gotoxy(5,5);cprintf("Enter Num:"); scanf("%1d",&p1->anum);
if(p1->anum==0){head1=NULL;goto end;}
gotoxy(5,7);cprintf("Enter Name:"); scanf("%s",p1->aname);
gotoxy(5,9);cprintf("Enter Your ID Number:"); scanf("%s",p1->id);
gotoxy(5,11);cprintf("Enter Your Certification:"); scanf("%s",p1->cert);
gotoxy(5,13);cprintf("Enter Your Ideal Job:"); scanf("%s",p1->rqurjob);
head1=NULL;
while(p1->anum!=0)
{
n=n+1;
if(n==1)head1=p1;
else p2->next1=p1;
p2=p1;
p1=(struct applicant *)malloc(LEN);
color();
textcolor(14);
gotoxy(6,3);cprintf("Please Enter Record:");
textcolor(1);
gotoxy(5,5);cprintf("Enter Num:"); scanf("%1d",&p1->anum);
if(p1->anum==0) goto end;
gotoxy(5,7);cprintf("Enter Name:"); scanf("%s",p1->aname);
gotoxy(5,9);cprintf("Enter Your ID number:"); scanf("%s",p1->id);
gotoxy(5,11);cprintf("Enter Your Certification:"); scanf("%s",p1->cert);
gotoxy(5,13);cprintf("Enter Your Ideal Job:"); scanf("%s",p1->rqurjob);
}
end:p2->next1=NULL;
head1=arrange1(head1);
gotoxy(5,16);cprintf("Save(Y.or,N)?");
c=getch();
if(c=='Y'||c=='y')save1(head1);
else head1=load1();
return(head1);
}
/*---------------------create job information----------------------*/
struct job *create2(void)
{
struct job * p3, * p4; struct job * head2;
struct job *load2(void);
struct job *arrange2(struct job * head2);
char d;
color();
k=0;
p3=p4=(struct job *)malloc(LENB);
textcolor(14);
gotoxy(7,3);cprintf("Please Enter Record:");
textcolor(1);
gotoxy(5,5);cprintf("Enter Job Number:"); scanf("%1d",&p3->jnum);
if(p3->jnum==0){head2=NULL;goto end;}
gotoxy(5,7);cprintf("Enter Job Name:"); scanf("%s",p3->jname);
gotoxy(5,9);cprintf("Enter The Amount Of The Job Needs:"); scanf("%i",p3->need);
head2=NULL;
while(p3->jnum!=0)
{
k=k+1;
if(k==1)head2=p3;
else p4->next2=p3;
p4=p3;
p3=(struct job * )malloc(LENB);
color();
textcolor(14);
gotoxy(7,3);cprintf("Please Enter Record:");
textcolor(1);
gotoxy(5,5);cprintf("Enter Job Number:"); scanf("%1d",&p3->jnum);
if(p3->jnum==0) goto end;
gotoxy(5,7);cprintf("Enter Job Name:"); scanf("%s",p3->jname);
gotoxy(5,9);cprintf("Enter The Amount Of The Job Needs:"); scanf("%i",p3->need);
}
end:p4->next2=NULL;
head2=arrange2(head2);
gotoxy(5,12);cprintf("Save(Y.Or,N)?");
d=getch();
if(d=='Y'||d=='y')save2(head2);
else head2=load2();
return(head2);
}