标题:各位大侠 unresolved external symbol 怎么解决 代码如下
只看楼主
lasanjin
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-7-22
 问题点数:0 回复次数:2 
各位大侠 unresolved external symbol 怎么解决 代码如下
我是用vc6.0编写的  调试的时候没有错误 组建的时候就出现问题了, 我是初学者 向各位大侠求救   
以下是代码和错误

记录个人信息 代码:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int meun_select();
void enter();
void inputs();
struct addr *des_store(struct addr *i,struct addr *top);
struct addr *find(char *name);
void search();
void deleted();
void display(struct addr *);
struct addr
{
    char name[30];
    char street[40];
    char city[20];
    char state[3];
    char tel[11];
    struct addr *next;  //pointer to next entry
};
void main()
{
    char s[80],choice;
    struct addr *info,*start,*last;
    start=last=NULL;
    for(;;)
        switch(meun_select())
        {
    case 1:enter();
        break;
    case 2:deleted();
        break;
    case 3:search();
        break;
    case 4:exit(0);
        }
}

int menu_select()      //出错的函数
{
    char s[80];
    int c;
    printf("1_Enter a name\n");
    printf("2_Delet a record\n");
    printf("3_Search\n");
    printf("4_Quit\n");
    do
    {
        printf("\nEnter your choice:");
        gets(s);
        c=atoi(s);
    }while(c<1||c>4);
    return(c);
}

void enter()
{
    struct addr *info,*start,*head;
    void inputs(char *,char *,int);
    int n;
    for(n=0;;n++)
    {
    info=(struct addr *)malloc(sizeof(addr));
    if(info==NULL)
    {
        printf("\n out of memory");
        return;
    }
    inputs("enter name:",info->name,30);
    if(info->name[0]=='0')
        break;
    else
    {
        inputs("enter street:",info->street,40);
        inputs("enter city:",info->city,20);
        inputs("enter state:",info->state,3);
        inputs("enter tel:",info->tel,11);
        start=des_store(info,start);
        if(n==0)
            head=start;
    }
    }

}
void inputs(char *p1,char *s,int count)
{
    char p[40];
    do
    {
        printf("%s",p1);
        gets(p);
        if(strlen(p)>count)
            printf("\n too long\n");
    }while(strlen(p)>count);
    strcpy(s,p);
}
struct addr *des_store(struct addr *i,struct addr *top)
{
    struct addr *last;
    if(!last)
    {
        last=i;
        return(i);
    }
    else
    {
        top->next=i;            //上一结点的指针项指向新结点;
        i->next=NULL;
        return(i);
    }
}

struct addr *find(char *name)
{
    struct addr *info,*head;
    info=head;
    while(info)
    {
        if(!strcmp(name,info->name))
            return(info);
        else
            info=info->next;
    }
    return(info);
}

void search()
{
    char name[40];
    struct addr *info;
    printf("enter name to find:");
    gets(name);
    if((info=find(name))==NULL)
        printf("not  found\n");
    else
        display(info);                //显示找到的结点;
}

void deleted()
{
    char s[80];
    struct addr *p1,*p2,*info,*head;
    printf("enter name");
    gets(s);
    info=find(s);
    if(info!=NULL)
    {
        if(head==info)
        {
            head=info->next;
            printf("deleted:%s\n",info->name);
            free(info);
        }
        else
        {
            p1=head->next;
            while(info!=p1)
            {
                p2=p1;
                p1=p1->next;
            }
            p2->next=p1->next;
            printf("deleted:%s\n",info->name);
            free(info);
        }
    }
    else
        printf("%s not find!\n",info->name);
}


void display(struct addr *info)
{
    printf("name:        %s",info->name);
    printf("street:        %s",info->street);
    printf("city:        %s",info->city);
    printf("state:        %s",info->state);
    printf("telphone:    %s",info->tel);
}

错误显示:

Address.obj : error LNK2001: unresolved external symbol "int __cdecl meun_select(void)" (?meun_select@@YAHXZ)


Debug/Address.exe : fatal error LNK1120: 1 unresolved externals


执行 link.exe 时出错.
搜索更多相关主题的帖子: symbol external unresolved void addr 
2008-08-19 09:41
chmlqw
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2007-10-11
得分:0 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int meun_select();   // 这里应该是 menu_select

一般出现这个错误提示:error LNK2001: unresolved external symbol
就是因为函数的拼写错误
2008-08-19 10:48
lasanjin
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2008-7-22
得分:0 
回复 2# chmlqw 的帖子
谢谢 就是这个问题

但是 如果这里拼写错误的话 那我的函数就没有声明 怎么还能调试通过的??
2008-08-19 11:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-228965-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.340310 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved