Difficulty getting my code to compile in g++

Messy as my coding style is, I feel this should be compiling in g++, so why might it not be? What options should I be compiling this with when I type g++ (for proper linkage)? Many thanks and 1,000 internets to any willing to sift through my code!

----------------------------------------------------------------------------------------------------------------------------------------------------------------
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include "StringWrap.h"
#include "PhraseJMK.h"

using namespace std;

int main(int argc, char *argv[])
{
    fstream file;
    vector<string> dass;
    vector<Phrase> diese;
    string temp;
    int truth = 0;
    bool flag;
    flag = 0;
    char period = '.';
    int words = 0;
    int letters = 0;
    StringWrap hilfer1;
    StringWrap hilfer2;
    Phrase* see;

    //Retrieves file name and subsequently opens it.
    //cout << "Enter your name of the file you want to open: ";
    //cin >> (temp);
    //char* offnen = (char*)temp.c_str();
    file.open(argv[0]);

    while(!file.eof())
    {
        file >> temp;
        dass.push_back(temp);
    }

    //How many words in file
    cout << "There are " << dass.size() << " many words in the file.  \n";

    for(int i=0; i < dass.size(); i++)
    {
        truth += dass[i].size();
    }

    //How many characters are in the file.
    cout << "There are " << truth << " many characters in the file. \n";

    //Word by word
    for(int i=0; i < dass.size(); i++)
    {
        //Letter by letter
        for(int j=0; j < dass[i].size(); j++)
        {
            if((dass[i].at(j) == period) || (dass[i].at(j) == '!') || (dass[i].at(j) == '?'))
            {
                flag = 1;
            }
        }

        words++;

        if(flag == 1)
        {
            temp += dass[i];
            see = new Phrase(temp, words);
            diese.push_back(*see);
            temp = "";
            words = 0;
        }

        if(flag == 0)
        {
            temp += dass[i];
            temp += " ";
        }

        flag = 0;
    }

    //Get the amount of words in each sentence, as well as the amount of characters
    //This is a printout of the file.
    for(int i = 0; i < diese.size(); i++)
    {
        cout << "Phrase below has " << diese[i].getNum() << " words. \n";
        cout << "Phrase below has " << diese[i].getPhrase().size() << " characters. \n";
        cout << diese[i].getPhrase() << "\n\n";
    }

    hilfer1 = StringWrap(diese[diese.size() - 2].getPhrase());
    hilfer2 = StringWrap(diese[diese.size() - 1].getPhrase());

    hilfer1.makeLower();
    hilfer1.trimNonAlpha();

    hilfer2.makeLower();
    hilfer2.trimNonAlpha();


    if(hilfer1.str().at(0) <= hilfer2.str().at(0))
    {
        cout << "The last phrase is greater than its preceding phrase: " << hilfer2.str() << " \n > " << hilfer1.str();
    }
    else
    {
        cout << "The last phrase is less than its preceding phrase: " << hilfer2.str() << " \n < " << hilfer1.str();
    }


}
What are the errors?
I am unsure of your question, but I will try to answer the bet I can with the understanding that I have .if you compile with
g++ nameoffile
it will compile to a file called a.out, use the -o option to change the name of the output file
Topic archived. No new replies allowed.