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);  //输出
}

``````

fatal error LNK1120: 1 unresolved externals

: 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?

Debug/SYN1.exe : fatal error LNK1120: 1 unresolved externals??

Debug/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 错误 问题

fatal error LNK1120: 6 unresolved externals
fatal error LNK1120: 10 unresolved externals

c++组建错误fatal error LNK1120: 1 unresolved externals

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

--------------------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
fatal error LNK1120: 9 unresolved externals 求解！？

Debug/fd.exe : fatal error LNK1120: 11 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大家帮忙看看
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什么原因，代码在里面

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如何解决??万分感激!!

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: 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???

c++ 运行调试出现这个错误 fatal error LNK1120: 9 unresolved externals

fatal error LNK1120是什么错误？

C++ debug 报错问题 fatal error LNK1120

error LNK2001 & fatal error LNK1120

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