我目前正在编写一个基本程序来评估数学表达式,然后我将在遗传编程中使用它来确定表达式系统的最佳解决方案。我的编译器一直在抱怨,但我几乎可以肯定我做的一切都是正确的。
错误:
C:\Users\Baelic Edeyn\Desktop\Project\Equation\Shunting yard\Better>make  
g++ -g -c Shunt.cpp  
g++ -g -c main.cpp  
main.cpp: In function 'int main()':  
main.cpp:18:19: error: 'shuntingYard' was not declared in this scope  
make: *** [main.o] Error 1
我的制作文件:
main: Shunt.o main.o  
    g++ -g Shunt.o main.o -o main  
main.o:main.cpp  
    g++ -g -c main.cpp  
Shunt.o:Shunt.cpp  
    g++ -g -c Shunt.cpp
我的主要:
#include "Shunt.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string expr = "3+ 47 *2/(1-5)^2^3";
    string expr1 = "a+b";
    string expr2 = "(a+b)";
    string expr3 = "a+b*!3";
    string expr4 = "(a+b)*!3";
    cout << "expression" << "   " << "postfix" << endl;
    cout << expr << "   ";
    shuntingYard(expr);
    cout << expr << endl;
    cout << expr1 << "      ";
    ...
    return 0;
}
我的头文件:
#ifndef SHUNT_H
#define SHUNT_H
#include <string>
using namespace std;
class Shunt
{
    public:
        int precedence(char);
        void shuntingYard(string &expr);
        bool isFunction(string);
        bool isOperator(char);
        bool isLeftAssociative(char);
        bool isNum(char);
    private:    
};
#endif
我的实现文件:
#include "Shunt.h"
using namespace std;
void Shunt::shuntingYard(string &expr)
{
    ...
}
请帮助我即将把我的笔记本电脑靠在墙上。