Error "Expected unqualified-id '(' token" in line 1

Hello, I am using Code Blocks and currently having an issue with debugging. I want to start debugging the problem but I only receive the error "Error Expected unqualified-id '(' token" in line 1" every time I try to compile. I am using headers and prototypes but I'm sure the problem lies in my header. I'll post the rest of my code but the header first

header
*JARVIS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef JARVIS_H
#define JARVIS_H

class math
    {
    private:
    int val1;
    int val2;

    public:

    math()
    {
    cout<<"calling math constructor"<<endl;
    }

    void setValues (int a, int b){
        int a = val1;
        int b = val2;
    }

    ~math()
    {
     cout<<"calling math deconstructor"<<endl;   
    }

}

class addition:public math
{
    int finalVal = val1 + val2;
    return finalVal;
};

class subtraction:public math
{
    int finalVal = val1 - val2;
    return finalVal;
};

class multiplication:public math
{
    int finalVal = val1 * val2;
    return finalVal;
};

class division:public math
{
    int finalVal = val1 / val2;
    return finalVal;
};

#endif  //JARVIS_H 


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <string>
#include "JARVIS.h"

using namespace std;

int main()
{
    string command;
    bool jarvis_running = false;
    cout << "J.A.R.V.I.S" << endl;
    cout << "Give a command from the list of commands available." << endl;
    cin >> command;

    if (command == "-h")
        {
        jarvis_running = true;
        cout << "The available commands are: math" << endl;
        }

    if (command = "math")
        {
        jarvis_running = true;
        math();
        }

    if (jarvis_running == false)
        {
        cout << "That command was not valid" << endl;
        cout << "Type '-h' if you need to know the available commands." << endl;
        }

    return 0;
}


*JarvisFunctions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <string>
#include "JARVIS.h"

using namespace std;

int math()
{
    char mathCommand;
    
    cout << "(A)ddition, (S)ubtraction, (M)ultiplication, or (D)ivision?" << endl;
    cin >> mathCommand;

    if (mathCommand == "A")
        {
        cout << "input the two integers you are adding" << endl;
        cin >> integer1 >> integer2;
    
        math.setValues(integer1, integer2);
        addition add;
        }


    else if(mathCommand == "S")
        {
        cout << "input the two integers you are subtracting" << endl;
        cin >> integer1 >> integer2;

        math.setValues(integer1, integer2);
        subtraction sub;
        }

    else if(mathCommand == "M")
        {
        cout << "input the two integers you are multiplying" << endl;
        cin >> integer1 >> integer2;

        math.setValue(integer1, integer2);
        mulitplication multi;
        }

    else if(mathCommand == "D")
        {
        cout << "input the two integers you are dividing" << endl;
        cin >> integer1 >> integer2;

        math.setValues(integer1, integer2);
        division div;
        }
    
    else
        {
        cout << "you did not input the right fuctions, either use A, S, M, or D" << endl;
        }
}


Thank you for your help.
Last edited on
A class declaration needs to end with a semi-colon, which you've missed out.
Change Jarvis.h line 27 from
} to };
Topic archived. No new replies allowed.