Compile Error

Posted on 2010-11-09
Last Modified: 2012-05-10
I am sure this is easy, I am trying to explore C++ using random websites and can not figure out why this will not compile.

I get the compile error at error C2660: 'SubExpression::parse' : function does not take 1 arrgument.

Thanks in advance

I have included subexpression as well
#include <iostream>

#include <fstream>

#include <strstream>

#include <string>

#include <vector>

using namespace std;

#include "expression.h"

#include "subexpression.h"

#include "symboltable.h"

#include "parse.h"

SymbolTable symbolTable;

void parseAssignments(strstream& in);

int main()


    const int SIZE = 256;

    Expression* expression;

    char paren, comma, line[SIZE];

    string program;

    ifstream fin("input.txt");

    while (true)




        fin.getline(line, SIZE);

        if (!fin)


        strstream in(line, SIZE);

        in >> paren;

        cout << line << " ";



            expression = SubExpression::parse(in); 

            in >> comma;  


            double result = expression->evaluate();

            cout << "Value = " << result << endl;    


        catch (exception& e)


              cout << "Standard exception: " << e.what() << endl;




    return 0;



void parseAssignments(strstream& in)


    char assignop, delimiter;

    string variable;

    double value;



        variable = parseName();

        in >> ws >> assignop >> value >> delimiter;

        symbolTable.insert(variable, value);


    while (delimiter == ',');


Open in new window

#include <iostream>

using namespace std;

#include "expression.h"

#include "subexpression.h"

#include "operand.h"

#include "plus.h"

#include "minus.h"

#include "times.h"

#include "divide.h"

SubExpression::SubExpression(Expression* left, Expression* right)


    this->left = left;

    this->right = right;


Expression* SubExpression::parse()


    Expression* left;

    Expression* right;

    char operation, paren;


    left = Operand::parse();

    cin >> operation;

    right = Operand::parse();

    cin >> paren;

    switch (operation)


        case '+':

            return new Plus(left, right);

        case '-':

            return new Minus(left, right);

        case '*':

            return new Times(left, right);

        case '/':

            return new Divide(left, right);


    return 0;


Open in new window

Question by:Chrispy2811
LVL 86

Accepted Solution

jkr earned 500 total points
Comment Utility
Well, as your snippet indicates, 'Expression* SubExpression::parse()' in fact take no arguments at all.

So, change

            expression = SubExpression::parse(in);

(line 37 in the 1st snippet) to read

            expression = SubExpression::parse();

and the error should go away.

Author Comment

Comment Utility
Man, its time to go to sleep.. Thanks for that, as soon as I read it I wondered how I missed it..

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now