질문 include문제입니다...
글쓴이: 바이러스 / 작성시간: 수, 2003/11/12 - 9:43오후
/*ExStudent.h*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _slist List;
typedef struct _slist {
int number;
char name[30];
List *next;
List *prev;
}List;
int screen();
void add();
void modify();
void seek();
void deldata();
헤더파일이고
main은
#include "ExStudent.h"
List *pList;
void init()
{
pList=(List *)malloc(sizeof(List));
strcpy(pList->name,"root");
pList->number=0;
pList->next=0;
pList->prev=0;
}
void freelist()
{
List *p;
p=pList;
while(p)
{
List *del;
del=p;
p=p->next;
free(del);
}
}
void main()
{
int choice;
init();
while((choice=screen())!=5)
{
switch(choice)
{
case 1:
add();
break;
case 2:
modify();
break;
case 3:
seek();
break;
case 4:
deldata();
break;
}
}
freelist();
}입니다만 컴파일은 하면
[kyo@localhost module]$ gcc main.c -o main
main.c: In function `main':
main.c:26: warning: return type of `main' is not `int'
/tmp/ccmM2fhf.o(.text+0xa3): In function `main':
: undefined reference to `screen'
/tmp/ccmM2fhf.o(.text+0xdb): In function `main':
: undefined reference to `add'
/tmp/ccmM2fhf.o(.text+0xe2): In function `main':
: undefined reference to `modify'
/tmp/ccmM2fhf.o(.text+0xe9): In function `main':
: undefined reference to `seek'
/tmp/ccmM2fhf.o(.text+0xf0): In function `main':
: undefined reference to `deldata'
collect2: ld returned 1 exit status
아마 함수를 못찾는것 같은데 다른분들 보기에는 어떻습니까?
Forums:


int screen(); void add(); void modif
int screen();
void add();
void modify();
void seek();
void deldata();
들을 정의한 소스파일을 같이 컴파일 해야죠...
[quote="맹고이"]int screen(); void add();
만약 그들을 정의한 소스파일들
ex)
#include "ExStudent.h" extern List *pList; void add() { List *p,*pNew; int number; char name[40]; {//입력 받는 모듈 printf("번호:"); scanf("%d",&number); printf("이름:"); scanf("%s",name); } p=pList; while(p->next) p=p->next; pNew=(List *)malloc(sizeof(List)); strcpy(pNew->name,name); pNew->number=number; pNew->prev=p; p->next=pNew; pNew->next=NULL; printf("입력이 완료 되었습니다.\n"); }정의했다면
란걸 하려면 어떻게 해야죠?
사람이 죽은뒤에 영혼이라는 것이 과연 존재 할까?죽음으로써 해답을 찾아보자...
...main뒤에void add(void){}voi
...main뒤에
void add(void)
{
}
void modify(void)
{
}
void seek(void)
{
}
void deldata(void)
{
}
int screen(void)
{
}
말 그대로...[code:1]gcc main.c a.c -o ma
말 그대로...
gcc main.c a.c -o main같이 컴파일하면 됩니다 -_-
노루가 사냥꾼의 손에서 벗어나는 것 같이, 새가 그물치는 자의 손에서 벗어나는 것 같이 스스로 구원하라 -잠언 6:5
댓글 달기