c++-编译时出现这样的错误,求大神指点解决方法

问题描述

编译时出现这样的错误,求大神指点解决方法
程序如下:
#include
using namespace std;
class zrf_Ratio;
zrf_Ratio operator+(const zrf_Ratio& r1 const zrf_Ratio& r2);
zrf_Ratio operator-(const zrf_Ratio& const zrf_Ratio&);
zrf_Ratio operator*(const zrf_Ratio& const zrf_Ratio&);
zrf_Ratio operator/(const zrf_Ratio& const zrf_Ratio&);

class zrf_Ratio
{
public:
zrf_Ratio(){}
zrf_Ratio(int r1int r2):num(r1)den(r2){}
zrf_Ratio f1(zrf_Ratio& z)
{
int rm=z.numn=z.den;
while(r=z.num%z.den)
{
z.num=z.den;
z.den=r;
}
r=z.den;
z.num=m/r;
z.den=n/r;
return z;
}
friend ostream& operator<<(ostream& ostr const zrf_Ratio& r)
{ return ostr << r.num << ""/"" << r.den;}

zrf_Ratio operator-(const zrf_Ratio& r1){return f1(zrf_Ratio(num*r1.den-r1.num*denden*r1.den));}friend zrf_Ratio operator+(const zrf_Ratio& r1 const zrf_Ratio& r2){    zrf_Ratio a;    return a.f1(zrf_Ratio(r1.num*r2.den+r2.num*r1.denr1.den*r2.den));}friend zrf_Ratio operator-(const zrf_Ratio& r1 const zrf_Ratio& r2){    zrf_Ratio a;    return a.f1(zrf_Ratio(r1.num*r2.den-r2.num*r1.denr1.den*r2.den));}friend zrf_Ratio operator*(const zrf_Ratio& r1 const zrf_Ratio& r2){    zrf_Ratio a;    return a.f1(zrf_Ratio(r1.num*r2.numr1.den*r2.den));}friend zrf_Ratio operator/(const zrf_Ratio& r1 const zrf_Ratio& r2){    zrf_Ratio a;    return a.f1(zrf_Ratio(r1.num*r2.denr1.den*r2.num));}

private:
int numden;
};
int mian()
{
zrf_Ratio x(37)y(49)z;
z=x.operator-(y);
cout<<""x-y=""<<z<<endl;
z=x+y;
cout<<""x+y=""<<z<<endl;
z=x-y;
cout<<""x-y=""<<z<<endl;
z=x*y;
cout<<""x*y=""<<z<<endl;
z=x/y;
cout<<""x/y=""<<z<<endl;
return 0;
}
显示错误如下:
Deleting intermediate files and output files for project '2 - Win32 Debug'.
--------------------Configuration: 2 - Win32 Debug--------------------
Compiling...
2.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/2.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

2.exe - 1 error(s) 0 warning(s)

解决方案

main拼写错了

解决方案二:
main拼写错误。。。

时间: 2024-09-12 13:51:23

c++-编译时出现这样的错误,求大神指点解决方法的相关文章

Atmel studio 6.0 编译之后PWM无输出,求大神指点

问题描述 Atmel studio 6.0 编译之后PWM无输出,求大神指点 使用的是atmega48芯片,程序如下: #include #include #include #define F_CPU 8000000UL #include #include #define uchar unsigned char #define uint unsigned int //控制单个io口 省略 uint a; //各端口初始化 void PORT_INIT(void) { DDRD=(1<<PD1)

jjjjjjj-关于网络链接的错误求大神指点

问题描述 关于网络链接的错误求大神指点 package com.example.urlget; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android

lamp-编译安装mysql出现问题,求大神指点

问题描述 编译安装mysql出现问题,求大神指点 编译安装MySQL时出现如下问题 自己是wins64 位的系统的VMware虚拟机中安装mysql版本是 mysql-5.5.28-linux2.6-x86_64.tar.gz mysql用户和mysql权限属主属组都修改成mysql.mysql了执行scripts/mysql_install_db 出现问题: [root@localhost mysql]# scripts/mysql_install_db --user=mysql --data

zoj中的一道题目,编译错误,求大神指点?

问题描述 zoj中的一道题目,编译错误,求大神指点? 解决方案 1. vector(int) a(2 * n_case); ----> vector<int> a(2 * n_case); //n_case建议初始化一下 2.cout << output(n_case); //不知道楼主想输出什么?这个output函数是void的 解决方案二: vector(int)换成尖括号.后面有关a的错误都是因为这个造成的. 解决方案三: 是因为你的vector没用对, 楼上正解

matchtample-在类中调用 opencv 的matchTample函数时,出现错误,求大神指点

问题描述 在类中调用 opencv 的matchTample函数时,出现错误,求大神指点 上图的代码出现在我的LightDetect类的一个类函数里,但是我新建一个工程,直接在main函数里调用matchTample是没问题的.是不是因为在类函数里不能分配太多内存?希望各位大神多多指点 解决方案 http://www.pudn.com/downloads635/sourcecode/graph/opencv/detail2575751.html

异常-C#运行时出现错误,求大神指点

问题描述 C#运行时出现错误,求大神指点 "System.FormatException"类型的未经处理的异常在 mscorlib.dll 中发生 其他信息: 输入字符串的格式不正确. 为什么doubleparse那里错了? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.L

poj 1276 背包问题 编译错误 求大神看看 英汉题意如下

问题描述 poj 1276 背包问题 编译错误 求大神看看 英汉题意如下 Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver appropriate @ bills for a requested cash amount. The machine uses exactly N distinct bill denominations, say Dk, k=

spring配置错误 求大神

问题描述 spring配置错误 求大神 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFac

ssh整合-spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!!

问题描述 spring整合hibernate做测试时没有报错,当三个整合时启动就报错啦,求大神指点!! 报的错误org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'ecsUnsigned' on target class [class $Proxy17] failed; nested exception is org.springframework.tran