1>delete.obj : error LNK2019: 无法解析的外部符号 "char __cdecl readfile(class

AmberPan721 2014-06-27 03:47:55
#include <iostream>
#include <windows.h>
#include <string>
#include <fstream>
#include <math.h>
#include "file_operate.h"
#include "delete.h"
using namespace std;

void refresh(int start,int end,fstream &f)//从start开始写到end
{
fstream f3;
f3.open("reftmp.txt",ios::binary|ios::out|ios::app);
char tp;
f.seekg(start,ios::beg);
for(int i=start/8; i<end/8; i++)
{
tp=readfile(f);
writefile(tp,f3);
}
f3.close();
}

void Delete()
{
char table_name[20];//buf判断数据类型缓冲
char tp;
char *str=".txt";
char tmp[30];
int i=0,w=0;
int num=0;//属性的个数
int length[10];//每个属性的长度
char name[20][20];//每个属性的名称
int start=0,end=0;
int power=0;//是否有删除的条目
tmp[i]=' ';
string cmpa,cmpb,value;
cout<<"Delete from ";
cin>>table_name;
cmpa=string(table_name);
fstream f1;
f1.open("model.txt",ios::binary|ios::in);//判断是否存在表;
o:
tmp[i]=readfile(f1);
i++;
if(f1.eof()==0)
{
while(tmp[i-1]!=',')
{
tmp[i]=readfile(f1);
i++;
}
tmp[i-1]='\0';
cmpb=string(tmp);
if(cmpa==cmpb)//表名存在
{
int nn=1;//读取逗号个数
f1.seekg(-8,ios::cur);
p:
tp=readfile(f1);//读取属性个数及每个属性长度及属性名称
if(tp!='!')
{
tp=readfile(f1);
while(tp!=',')
{
name[num][w]=tp;
w++;
tp=readfile(f1);
}
name[num][w]='\0';
w=0;
tp=readfile(f1);
while(nn<=1)
{
tp=readfile(f1);
if(tp==',')
{
nn++;
}

}
tp=readfile(f1);
length[num]=(int)tp-48;
tp=readfile(f1);
if(tp<='9'&&tp>='0')
{
length[num]=length[num]*10+((int)tp-48);
tp=readfile(f1);

if(tp<='9'&&tp>='0')
{
length[num]=length[num]*10+((int)tp-48);
}
else
{
f1.seekg(-8,ios::cur);
}
}
else
{
f1.seekg(-8,ios::cur);
}
num++;
nn=1;
goto p;
}
else
{
f1.close();
}
strcat(table_name,str);//table_name 表名
fstream f2;
f2.open(table_name,ios::binary|ios::in);
cout<<"where ";

char tiaojian1[20];
cin>>tiaojian1;//属性名
cout<<"=";
char tiaojian2[20];
cin>>tiaojian2;
string tiaojian2str=string(tiaojian2);
string tiaojian1str=string(tiaojian1);
string shuxing;
int pos=0;//第pos个属性是有用的
for(int z=0; z<num; z++)
{
shuxing=string(name[z]);
if(tiaojian1str==shuxing)//没有判断属性是否存在
{
pos=z;
break;
}
}
int sum=0;//每条数据的间隔位数
for(int z=0; z<num; z++)
{
sum=sum+length[z]*8;
}
sum=sum-length[pos]*8;
int firstpos=0;//最开始后移位数
for(int z=0; z<pos; z++)
{
firstpos=firstpos+length[z]*8;
}

f2.seekg(firstpos,ios::cur);//第一个
char tmpp[30];//属性值
string tmpstr;
int time=0;//第几条数据是应当删除的
while(1)
{
for(int z=0; z<length[pos]; z++)
{
tmpp[z]=readfile(f2);
if(tmpp[z]==' ')
{
tmpp[z]='\0';
}
tmpp[z+1]='\0';
}
time++;
tmpstr=string(tmpp);
if(tmpstr==tiaojian2str)
{
end=time*(length[pos]*8+sum);
refresh(start,end-length[pos]*8-sum,f2);
f2.seekg(end-(sum-firstpos),ios::beg);
power=1;
start=end;
}
// f2.seekg(sum-firstpos,ios::cur);
if(f2.eof()!=0)
{
if(power==0)
{
cout<<"符合条件元素不存在!"<<endl;
return;
}
else
{
f2.close();
end=(time-1)*(length[pos]*8+sum);
fstream f4;
f4.open(table_name,ios::binary|ios::in);
refresh(start,end,f4);
f4.close();
char tt[]="del ";
strcat(tt,table_name);
system(tt);
rename("reftmp.txt",table_name);
cout<<"删除完成!"<<endl;
return;
}
}
else
{
//f2.seekg(firstpos-sum,ios::cur);
}
f2.seekg(sum,ios::cur);//间隔
}

f2.close();
return;
}
else
{
tp=readfile(f1);
while(tp!='!')
{
tp=readfile(f1);
}
i=0;
goto o;
}
}
else
{
cout<<"the table is not exist."<<endl;
f1.close();
return;
}
}
1>------ 已启动生成: 项目: 数据库, 配置: Debug Win32 ------
1>delete.obj : error LNK2019: 无法解析的外部符号 "char __cdecl readfile(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?readfile@@YADAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z),该符号在函数 "void __cdecl Delete(void)" (?Delete@@YAXXZ) 中被引用
1>delete.obj : error LNK2019: 无法解析的外部符号 "void __cdecl writefile(char,class std::basic_fstream<char,struct std::char_traits<char> > &)" (?writefile@@YAXDAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z),该符号在函数 "void __cdecl refresh(int,int,class std::basic_fstream<char,struct std::char_traits<char> > &)" (?refresh@@YAXHHAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z) 中被引用
1>C:\Users\Amber.Amber-PC\Desktop\Win32Project2\Debug\数据库.exe : fatal error LNK1120: 2 个无法解析的外部命令
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

各位大神。。有知道怎么整的么、、、折腾了一晚上了。。。。
...全文
354 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
AmberPan721 2014-06-27
  • 打赏
  • 举报
回复
引用 8 楼 zhao4zhong1 的回复:
少file_operate.c文件。我猜。
真的呃。。。我忘记添加这个了。。。多谢啦~~~
勤奋的小游侠 2014-06-27
  • 打赏
  • 举报
回复
引用 8 楼 zhao4zhong1 的回复:
少file_operate.c文件。我猜。
支持。这两个函数的操作没有定义 。 看起来也不像在系统的lib里面
赵4老师 2014-06-27
  • 打赏
  • 举报
回复
少file_operate.c文件。我猜。
AmberPan721 2014-06-27
  • 打赏
  • 举报
回复
引用 5 楼 zhao4zhong1 的回复:
将错误信息中出现的标识符放在google里面搜一下,看其在哪个.lib中,然后在本地硬盘上搜索该.lib,如果没有,在网上搜索相关库或模块下载安装,然后将其所在目录填写到“附加依赖库所在目录”中,将其名字添加到“附加依赖库”中,重新连接。 VC6: 工程、设置、C/C++、分类:Preprocessor、附加包含路径:填写附加头文件所在目录 逗号间隔多项 工程、设置、Link、分类:Input、附加库路径:填写附加依赖库所在目录 分号间隔多项 工程、设置、Link、分类:Input、对象/库模块:填写附加依赖库的名字.lib 空格间隔多项 VS20xx: 项目、属性、C/C++、附加包含目录:填写附加头文件所在目录 分号间隔多项 项目、属性、链接器、常规、附加库目录:填写附加依赖库所在目录 分号间隔多项 项目、属性、链接器、输入、附加依赖项:填写附加依赖库的名字.lib 空格或分号间隔多项
额。。。谷歌学校里上不上啊。。。。帮下忙搜一下吧。。。。
AmberPan721 2014-06-27
  • 打赏
  • 举报
回复
引用 3 楼 jianwen0529 的回复:
没有找到函数的实现 看看依赖有没有包含lib(静态库)或者dll(动态库) 另外建议现在写程序,尽量不要使用goto
额。。。具体该怎么做。。。刚学。。不太明白。。。网上也搜了很多解决方法。。可是没看懂。。。求具体做法。。。
赵4老师 2014-06-27
  • 打赏
  • 举报
回复
将错误信息中出现的标识符放在google里面搜一下,看其在哪个.lib中,然后在本地硬盘上搜索该.lib,如果没有,在网上搜索相关库或模块下载安装,然后将其所在目录填写到“附加依赖库所在目录”中,将其名字添加到“附加依赖库”中,重新连接。 VC6: 工程、设置、C/C++、分类:Preprocessor、附加包含路径:填写附加头文件所在目录 逗号间隔多项 工程、设置、Link、分类:Input、附加库路径:填写附加依赖库所在目录 分号间隔多项 工程、设置、Link、分类:Input、对象/库模块:填写附加依赖库的名字.lib 空格间隔多项 VS20xx: 项目、属性、C/C++、附加包含目录:填写附加头文件所在目录 分号间隔多项 项目、属性、链接器、常规、附加库目录:填写附加依赖库所在目录 分号间隔多项 项目、属性、链接器、输入、附加依赖项:填写附加依赖库的名字.lib 空格或分号间隔多项
caozl 2014-06-27
  • 打赏
  • 举报
回复
无法解析的外部符号 就是没有函数实现 需要CPP或者lib(静态库)里有这个函数 DLL在运行的时候才需要
幻夢之葉 2014-06-27
  • 打赏
  • 举报
回复
没有找到函数的实现 看看依赖有没有包含lib(静态库)或者dll(动态库) 另外建议现在写程序,尽量不要使用goto
AmberPan721 2014-06-27
  • 打赏
  • 举报
回复
快来个大神吧。。。。
AmberPan721 2014-06-27
  • 打赏
  • 举报
回复
以及还有这么个问题
#include <iostream>
#include <windows.h>
#include <string>
#include <fstream>
#include <math.h>
#include "file_operate.h"
#include "insert.h"
using namespace std;

void insert()
{
    char table_name[20],buff[100],buf[100];//buff输出缓冲区,buf判断数据类型缓冲
    char tp;
    char *str=".txt";
    char tmp[20];
    int i=0,w=0,pos;//pos记录插入值位置
    int num=0;//属性的个数
    int length[10];//每个属性的长度
    char type[20][20];//每个属性的类型
    char insertbuff[1000];//插入的一条数据
    char table_buff[1500][10][100];//将表读入内存
    char ttp,ttpv[100],ttpb[100];
    int data_num=0,pp=0;//数据条数
    int key=1,ss=0;//主键的序号
    fstream f7;
    f7.open("key.txt",ios::binary|ios::in);
    string inputkeystr;//输入主键的内容
    tmp[i]=' ';
    string cmpa,cmpb,value;
    cout<<"Insert into ";
    cin>>table_name;
    cmpa=string(table_name);
    tp=readfile(f7);
    string ttpbstr;
    /* while(f7.eof()==0)
     {
         cout<<readfile(f7);
     }*/

    fstream f1;
    f1.open("model.txt",ios::binary|ios::in);//判断是否存在表;
o:
    tmp[i]=readfile(f1);
    i++;
    if(f1.eof()==0)
    {
        while(tmp[i-1]!=',')
        {
            tmp[i]=readfile(f1);
            i++;
        }
        tmp[i-1]='\0';
        cmpb=string(tmp);
        if(cmpa==cmpb)//表名存在
        {
            while(f7.eof()==0)
            {
                while(tp!=',')
                {
                    if(tp=='!')
                        tp=readfile(f7);
                    ttpb[ss]=tp;
                    tp=readfile(f7);
                    ttpb[ss+1]='\0';
                    ss++;
                }
                ss=0;
                ttpbstr=string(ttpb);
                if(ttpbstr==cmpa)
                {
                    tp=readfile(f7);
                    key=(int)tp-48;
                    break;
                }
                else
                {
                    tp=readfile(f7);
                    tp=readfile(f7);
                }
            }
            f7.close();
            int nn=1;//读取逗号个数,要读连续两个读取一个int
p:
            tp=readfile(f1);//读取属性个数及每个属性长度及属性类型

            if(tp!='!')
            {
                while(nn<=1)
                {
                    tp=readfile(f1);
                    if(tp==',')
                    {
                        nn++;
                    }

                }
                tp=readfile(f1);
                while(tp!=',')
                {
                    type[num][w]=tp;
                    w++;
                    tp=readfile(f1);
                }
                w=0;
                tp=readfile(f1);
                length[num]=(int)tp-48;
                tp=readfile(f1);
                if(tp<='9'&&tp>='0')
                {
                    length[num]=length[num]*10+((int)tp-48);
                    tp=readfile(f1);

                    if(tp<='9'&&tp>='0')
                    {
                        length[num]=length[num]*10+((int)tp-48);
                    }
                    else
                    {
                        f1.seekg(-8,ios::cur);
                    }
                }
                else
                {
                    f1.seekg(-8,ios::cur);
                }
                num++;
                nn=1;
                goto p;
            }
            else
            {
                f1.close();
            }
            strcat(table_name,str);//table_name 表名
            fstream f2;
            f2.open(table_name,ios::binary|ios::in);
            while(f2.eof()==0)
            {

                for(int p=0; p<num; p++)
                {
                    for(int r=0; r<length[p]; r++)
                    {
                        ttp=readfile(f2);
                        table_buff[data_num][p][r]=ttp;
                    }
                }
                data_num++;
            }
            data_num--;
            cout<<"values ('";
            int buff_long;
            int base=0;//记录insertbuff记录到哪一位
            for(int z=0; z<num; z++)
            {
s:
                cin>>value;
                if(z==(key-1))
                {
                    inputkeystr=value;
                }
                int buf_long,q=0;
                buf_long=value.copy(buf,90);
                buf[buf_long]='\0';
                switch(type[z][0])
                {
                case 'i':
                    if(buf_long>length[z])
                    {
                        cout<<"the value is too long,it should be "<<length[z]<<" try again!"<<endl;
                        goto s;
                    }
                    while(buf[q]!='\0')
                    {
                        if(buf[q]<'0'||buf[q]>'9')
                        {
                            cout<<"the value is wrong type! the type should be "<<type[z]<<" try again!"<<endl;
                            goto s;
                        }
                        q++;
                    }
                    break;
                case 'v':
                    if(buf_long>length[z])
                    {
                        cout<<"the value is too long,it should be "<<length[z]<<" try again!"<<endl;
                        goto s;
                    }
                    break;
                case 'd':
                    buf_long=value.copy(buf,90);
                    buf[buf_long]='\0';
                    if(buf_long!=length[z])
                    {
                        cout<<"the value's length is wrong,it should be "<<length[z]<<" try again!"<<endl;
                        goto s;
                    }
                    while(buf[q]!='\0')
                    {
                        if(buf[q]<'0'||buf[q]>'9')
                        {
                            cout<<"the value is wrong type! the type should be "<<type[z]<<" try again!"<<endl;
                            goto s;
                        }
                        q++;
                        if(q>8)
                        {
                            cout<<"the value is wrong type! the type should be "<<type[z]<<" try again!"<<endl;
                            goto s;
                        }
                    }
                    break;
                }
                string strtmp;
                for(int j=0; j<length[z]-value.size(); j++)
                {
                    strtmp=strtmp+" ";
                }
                value=value+strtmp;
                buff_long = value.copy(buff, 90);
                buff[buff_long] = '\0';
                for(pp=0; pp<=buff_long; pp++)
                    insertbuff[base+pp]=buff[pp];
                base=base+pp-1;
                string ttpp;
                if(z==(num-1))
                {
                    pos=data_num;
                    for(int i=0; i<data_num; i++)
                    {
                        for(int j=0; j<length[key-1]; j++)
                        {
                            if(table_buff[i][key-1][j]!=' ')
                            {
                                 ttpv[j]=table_buff[i][key-1][j];
                                 ttpv[j+1]='\0';
                            }

                        }
                        ttpp=string(ttpv);
                        if(ttpp==inputkeystr)
                        {
                            cout<<"主键重复!请重试!"<<endl;
                            return;
                        }
                        if(ttpp>inputkeystr)
                        {
                            pos=i;
                            break;
                        }
                    }
                    f2.close();
                    fstream f6;
                    f6.open(table_name,ios::binary|ios::out);
                    for(int t=0; t<pos; t++)
                    {
                        for(int y=0; y<num; y++)
                        {
                            for(int u=0; u<length[y]; u++)
                            {
                                writefile(table_buff[t][y][u],f6);
                            }
                        }
                    }
                    for(int t=0; t<base; t++)
                    {
                        writefile(insertbuff[t],f6);
                    }
                    for(int t=pos; t<data_num; t++)
                    {
                        for(int y=0; y<num; y++)
                        {
                            for(int u=0; u<length[y]; u++)
                            {
                                writefile(table_buff[t][y][u],f6);
                            }
                        }
                    }
                    cout<<"')"<<endl<<"插入成功"<<endl;
                }

                else
                    cout<<"','";
            }
            f2.close();
            return;
        }
        else
        {
            tp=readfile(f1);
            while(tp!='!')
            {
                tp=readfile(f1);
            }
            i=0;
            goto o;
        }
    }
    else
    {
        cout<<"the table is not exist."<<endl;
        f1.close();
        return;
    }
}
1>insert.obj : error LNK2001: 无法解析的外部符号 "char __cdecl readfile(class std::basic_fstream<char,struct std::char_traits<char> > &)" (?readfile@@YADAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)
1>insert.obj : error LNK2001: 无法解析的外部符号 "void __cdecl writefile(char,class std::basic_fstream<char,struct std::char_traits<char> > &)" (?writefile@@YAXDAAV?$basic_fstream@DU?$char_traits@D@std@@@std@@@Z)
​ 博主介绍:✌在职Java研发工程师、专注于程序设计、源码分享、技术交流、专注于Java技术领域和毕业设计✌项目名称基于Web的酒店客房管理系统的设计与实现系统说明3.2.1  用户模块功能分析前台模块应主要包括用户登录模块、用户注册模块、查看客房信息模块、客房预定 模块、用户留言模块、充值模块和个人信息维护模块。用户登录模块:用户通过输入注册的的账号和密码,然后进行身份验证,匹配成功 后实现登录功能。用户注册模块:用户输入合法的账号和密码可以实现注册功能。 查看客房信息模块:用户可以通过首页查看客房的价格,图片,详情等信息,从而   可以选择想要预定的房间。 客房预定模块:用户选择自己想要预定的客房后,可以通过输入相关信息进行订房操作。用户留言模块:用户可以向管理员发送留言。 充值模块:用户可以通过添加银行卡再为自己进行充值操作。 个人信息维护模块:用户可以修改自己的姓名、密码、身份证号等信息,还可以查看自己的订单。3.2.2  管理员模块功能分析对于管理员而言,一个好的管理系统总是能让酒店的管理工作事半功倍[7]。管理员 能够通过这个系统对自己的酒店情况一目了然,应该包括客户留言模块、客房管理模 块、订房信息管理模块、入住信息管理模块、统计分析模块、酒店新闻管理模块、会 员信息管理模块、员工信息管理模块、系统用户管理模块、个人信息维护模块。客户留言模块:管理员可以查看并回复用户的留言。客房管理模块:管理员可以管理客房信息,可以添加新的客房,删除已经停用的客房信息,还可以修改现有的客房信息。订房信息管理模块:管理员可以处理用户的订房请求,为用户办理入住手续。入住信息管理模块:对于没有注册的线下客户,也可以办理入住手续。统计分析模块:可以对酒店所有的入住信息进行记录和总结分析。酒店新闻管理模块:管理员可以更新网站上的新闻公告,展示图片等信息。会员信息管理模块:管理员可以查看到所有的注册会员信息,可以对会员信息进行删除,修改,添加操作。员工信息管理模块:管理员可以查看到自己公司所有的员工信息,而且还可以对员工的相关信息进行管理。系统用户管理模块:管理员可以查看到所有的系统管理员信息并对管理员信息进行管理。个人信息维护模块:管理员可以更改自己的登录密码或者是姓名、性别、手机号等 相关个人信息。​编辑 环境需要1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本;6.是否Maven项目:否;技术栈1. 后端:Spring+SpringMVC+Mybatis2. 前端:JSP+CSS+JavaScript+jQuery使用说明1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置;4. 运行项目,在浏览器中输入http://localhost:8080/ 登录运行截图​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑​编辑 用户管理控制层:package com.houserss.controller;import javax.servlet.http.HttpSession;import org.apache.commons.lang3.StringUtils;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import com.houserss.common.Const;import com.houserss.common.Const.Role;import com.houserss.common.ServerResponse;import com.houserss.pojo.User;import com.houserss.service.IUserService;import com.houserss.service.impl.UserServiceImpl;import com.houserss.util.MD5Util;import com.houserss.util.TimeUtils;import com.houserss.vo.DeleteHouseVo;import com.houserss.vo.PageInfoVo;/** * Created by admin */@Controller@RequestMapping(/user/)public class UserController if (ip != null && ip.length() > 0) String[] ips = ip.split(,);for (int i = 0; i  

64,683

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧