zoukankan      html  css  js  c++  java
  • 经典编译错误收集

    1class Carton : public Box
    提示一大堆几十个错误,看来是类出了问题,这其实是全角符号和半角符号的区别的问题,将:改为:即可。
    其他还有“与",{}与{}等 。

    2myBox.showVolume;
    提示: statement cannot resolve address of overloaded function
    这是调用成员函数时忘记加括号,应为myBox.showVolume();
    3#include <iosteam>
    using namespace std;
    cout<< "This is a example." << endl;
    提示  iosteam: No such file or directory.
           `cout' undeclared (first use this function) ,
    一个经典的错误,将iostream写错。
    4new types may not be defined in a return type
    two or more data types in declaration of `Draw'
    prototype for `Rectangle Rectangle::Draw()' does not match any in class `Rectangle'
    `Rectangle Rectangle::Draw()' and `virtual void Rectangle::Draw()' cannot be overloaded
    出现四五条错误提示如上,这也是非常常见的错误,原因在于声明了Rectangle类后的}后没有加“;”,然后继续实现 Rectangle::Draw(),  
    5multiple types in one declaration
    此编译错误与上面的第4条类似,也是忘记类声明后忘记加分号,但是在声明的两个类之间 ,中间没有成员函数的实现。
    6cannot resolve overloaded function `precision' based on conversion to type `std::streamsize '
    原语句是 streamsize prec = cout.precision;
    这也是非常容易犯的错误,是调用成员函数时没有加(),上面的语句应为
    streamsize prec = cout.precision();

  • 相关阅读:
    UVa 11181 (条件概率) Probability|Given
    UVa 1636 (概率) Headshot
    UVa 1262 (第k字典序) Password
    HDU 4746 (莫比乌斯反演) Mophues
    HDU 1695 (莫比乌斯反演) GCD
    POJ 3090 (欧拉函数) Visible Lattice Points
    CodeForces Round #283 Div.2
    UVa 10820 (打表、欧拉函数) Send a Table
    UVa 1635 (唯一分解定理) Irrelevant Elements
    Java基础10 接口的继承与抽象类
  • 原文地址:https://www.cnblogs.com/xx123/p/10423860.html
Copyright © 2011-2022 走看看