C 언어 컴파일 에러가 나왔는데 이해하기가 힘들어요
글쓴이: I LY@Google / 작성시간: 화, 2021/12/21 - 11:04오전
정의 되지않은 참조라니 무슨 뜻인가요?
root@ilya:/home/ilya/tools# gcc password.c /usr/bin/ld: /tmp/ccoYZ8ot.o: in function `main': password.c:(.text+0x24): undefined reference to `passwordU' collect2: error: ld returned 1 exit status root@ilya:/home/ilya/tools# #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #define CRU 1 #define RMU 2 #define BUU 3 #define MFU 4 #define CREATE_USER 3, 1 #define REMOVE_USER 2, 2 #define BACK_UP_USER 2, 3 #define MODIFY_USER 2, 4 typedef struct UserLinkList { struct userStruct* next; struct userStruct* prev; }UserLinkList; struct userStruct { char name[30]; int user_id; int userPassword; int limeitDay; UserLinkList link; int authority; }; int passwordU(int args, ...); struct userStruct* createU(struct userStruct* rootUser); int main() { struct userStruct rootUser; passwordU(3, 1, &rootUser, 1); } int passswordU(int args, ...) { struct userStruct* rootUser; int flag; va_list ap; va_start(ap, args); flag = va_arg(ap, int); struct userStruct* new_user; rootUser = va_arg(ap, struct userStruct*); if (flag == CRU) { new_user = createU(rootUser); new_user->authority = va_arg(ap, int); } else if (flag == RMU) { } else if (flag == BUU) { } else if (flag == MFU) { } else { return -1; } va_end(ap); return 0; } struct userStruct* createU(struct userStruct* rootUser) { size_t uS_size = sizeof(struct userStruct); struct userStruct* new_user; struct userStruct* perv_user = rootUser; struct userStruct* next_user = rootUser; new_user = (struct userStruct*)malloc(uS_size); while (1) { if (next_user->link.next == 0) { next_user->link.next = new_user; new_user->link.prev = next_user; break; } next_user = perv_user->link.next; perv_user = next_user; } return 0; }
Forums:
제가 멍청했내요
passsword 하... s가 하나더 들어 있었내요
댓글 달기