C++问题LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
来源:百度知道 编辑:UC知道 时间:2024/09/19 16:13:03
请问:下面程序为什么在连接时有错,而在不用类模板时又没有错
另外:operator() 、operator== 在程序中是究竟是怎样被调用的
#include <iostream>
#include <set>
using namespace std;
template <class T>
class RuntimeCmp {
public:
enum cmp_mode {normal, reverse};
private:
cmp_mode mode;
public:
//constructor for sorting criterion
//-default criterion uses value normal
RuntimeCmp (cmp_mode m=normal) : mode(m) {
}
//comparision of elements
bool operator() (const T& t1, const T& t2) const {
return mode == normal ? t1 < t2 : t2 < t1;
}
//comparision of sorting criteria
bool operator== (const RuntimeCmp& rc) {
return mode == rc.mode;
}
};
//type of a set that uses this sorting criterion
typedef set<int,RuntimeCmp<int> > IntSet;
void fill (IntSet& Set)
{
//fill ins
另外:operator() 、operator== 在程序中是究竟是怎样被调用的
#include <iostream>
#include <set>
using namespace std;
template <class T>
class RuntimeCmp {
public:
enum cmp_mode {normal, reverse};
private:
cmp_mode mode;
public:
//constructor for sorting criterion
//-default criterion uses value normal
RuntimeCmp (cmp_mode m=normal) : mode(m) {
}
//comparision of elements
bool operator() (const T& t1, const T& t2) const {
return mode == normal ? t1 < t2 : t2 < t1;
}
//comparision of sorting criteria
bool operator== (const RuntimeCmp& rc) {
return mode == rc.mode;
}
};
//type of a set that uses this sorting criterion
typedef set<int,RuntimeCmp<int> > IntSet;
void fill (IntSet& Set)
{
//fill ins
没写main函数呗
根据你的出错信息来看,要么你没有main,要么你有多余的main
这些运算符的调用和函数是一样的
他们有参数,也有返回类型,当然并不是所有的都是这样,如 operator type()就没有返回类型,其实type就是,调用我也不太清楚.如class operator+(),如是全局的则()内的一个是左操作数,一个是右操作数 ,class代表返回值,operator==类似
vc提示“LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16”是什么意思
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16为什么会有错误
VC错误 LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
fortran 中的sgl.lib 问题
C++问题,关于LIB库文件
开发c++MFC的时候如何调用lib文件
=.;C:\j2sdk1.4.2_09\lib
eclipse向lib中导入jar包的问题
菜鸟问题 急待解决 C++ LIB文件? 内详!!!
C:\\WINDOWS\\SYSTEM32\\psapi.lib