Need help with getting my program to work.

Pages: 12
I would like my monster to have the armor and shields stats.
86 C:\Dev-Cpp\newgame.cpp `Steel1' undeclared (first use this function) 
87 C:\Dev-Cpp\newgame.cpp `Spectral1' undeclared (first use this function) 
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <windows.h>
using namespace std;
/*Armor prevents monsters from being
destroyed and must be repaired to work
up to it's maximum capability.*/
class Armor
{
    int Weight;
    int Armor_Health;
public:
Armor(){};
~Armor(){};    
    int GetWeight(){return Weight;}
	void SetWeight(int x){Weight = x;}
	int GetArmor_Health(){return Armor_Health;} 
	void SetArmor_Health(int x){Armor_Health = x;}
	void Steel1();
};
/*Shields defend the monsters from most
damage and regenerate after each battle.*/
class Shield
{	
    int Weight;
    int Defense;
    string Resists;
    int Shield_Energy;
public:
Shield(){}; 
~Shield(){};    
    int GetWeight(){return Weight;} 
	void SetWeight(int x){Weight = x;}
	int GetDefense(){return Defense;} 
	void SetDefense(int x){Defense = x;}
	string GetResists(){return Resists;} 
	void SetResists(string x){Resists = x;}
	int GetShield_Energy(){return Shield_Energy;} 
	void SetShield_Energy(int x){Shield_Energy = x;}
	void Spectral1();
};
/*Monsters are what you use to battle and
they can hold weapons, armor, and shields.*/
class Monster
{	
    int Weight;
    int Monster_Health;
    int Monster_Armor;
    int Monster_Shields;
    int Monster_Damage;
    Armor slot1;
    Shield slot2;
public:
Monster(){}; 
~Monster(){};   
    int GetWeight(){return Weight;}  
	void SetWeight(int x){Weight = x;}
	int GetMonster_Health(){return Monster_Health;}  
	void SetMonster_Health(int x){Monster_Health = x;}
	int GetMonster_Armor(){return Monster_Armor;} 
	void SetMonster_Armor(int x){Monster_Armor = x;}
	int GetMonster_Shields(){return Monster_Shields;}  
	void SetMonster_Shields(int x){Monster_Shields = x;}
	int GetMonster_Damage(){return Monster_Damage;}  
	void SetMonster_Damage(int x){Monster_Damage = x;}
	void Level1();
};
void Armor::Steel1() 
{	
    Weight = 50;
    Armor_Health = 150;
}
void Shield::Spectral1()
{	
    Weight = 50;
    Defense = 90;
    Resists = "none";
    Shield_Energy = 100;
}
void Monster::Level1() //Default Name
{	
    slot1 = Steel1();
    slot2 = Spectral1();
    Weight = 50;
    Monster_Health = 200;
    Monster_Armor = 0;//Not integrated yet. Should be steel 1 stats.
    Monster_Shields = 200;//Not integrated yet. Should be spectral 1 stats
    Monster_Damage = 10;

}
inline void delay( unsigned long ms ) 
{ 
Sleep( ms );
}  
void MonsterAttack(Monster & Monster1, Monster & Monster2)
{
    //Tests if the monster's shield is equal to 0, if so damage is subtracted from health.
    if(Monster2.GetMonster_Shields() == 0)
    {Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage());}
    //Tests if the monster's shield is greater than 0, if so damage is subtracted from the shield and monster's health.
    if(Monster2.GetMonster_Shields() > 0)
    {Monster2.SetMonster_Shields(Monster2.GetMonster_Shields() - Monster1.GetMonster_Damage());
    Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage() / 10);}
    //Tests if the monster's shield is less than 0, if so the shield's value is equal to 0.
    if(Monster2.GetMonster_Shields() < 0)
    {Monster2.SetMonster_Shields(0);}
    //Tests if the monster's health is less than 0, if so the monsters's health is equal to 0.
    if(Monster2.GetMonster_Health() < 0)
    {Monster2.SetMonster_Health(0);}
    //Tests if the monster's health is equal to 0, if so the monsters's shield is equal to 0.
    if(Monster2.GetMonster_Health() == 0)
    {Monster2.SetMonster_Shields(0);}
}
void MonsterRepair(Monster & Monster1)
{
    //Sets the monster's shield to 200.
    Monster1.SetMonster_Shields(200);
    //If the monster's health is less than 200, the monster's health will start repairing up to 200.
    while (Monster1.GetMonster_Health() < 200)
    {
    Monster1.SetMonster_Health(Monster1.GetMonster_Health()+1);
    system("CLS");//Sake of posting on forums in 1 file.
    cout << "Repairing Monster1" << endl << endl;
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< endl;
    delay(50);
    }
}
void BattlePhase (Monster & Monster1, Monster & Monster2)//does the battle phase
{
    while (Monster1.GetMonster_Health() > 0 && Monster2.GetMonster_Health() > 0)
    {
    MonsterAttack(Monster1, Monster2);
    MonsterAttack(Monster2, Monster1);
    system("CLS");//Sake of posting on forums in 1 file.
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << "\t";
    cout << "Monster2 Health  " << Monster2.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< "\t";
    cout << "Monster2 Shields " << Monster2.GetMonster_Shields()<< endl;
    delay(300);
    }
    MonsterRepair(Monster1);
    
}
int main(int argc, char *argv[])
{	
    Monster YourMonster1;
	Monster OpponentMonster1;
    YourMonster1.Level1();
    OpponentMonster1.Level1();
    BattlePhase (YourMonster1, OpponentMonster1);
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    return 0;
}
It is exactly what it says. These functions are members of Armor and Shield classes and must be used lite that:
1
2
Armor x;
x.Steel1()
It seems that in this function

1
2
3
4
5
6
7
8
9
10
11
void Monster::Level1() //Default Name
{	
    slot1 = Steel1();
    slot2 = Spectral1();
    Weight = 50;
    Monster_Health = 200;
    Monster_Armor = 0;//Not integrated yet. Should be steel 1 stats.
    Monster_Shields = 200;//Not integrated yet. Should be spectral 1 stats
    Monster_Damage = 10;

}

there shall be

1
2
3
4
5
6
7
8
9
10
11
void Monster::Level1() //Default Name
{	
    slot1.Steel1();
    slot2.Spectral1();
    Weight = 50;
    Monster_Health = 200;
    Monster_Armor = 0;//Not integrated yet. Should be steel 1 stats.
    Monster_Shields = 200;//Not integrated yet. Should be spectral 1 stats
    Monster_Damage = 10;

}
Thanks that fixed my problem!
what did i mess up now?, (you may need to replace my clearscreen function with system("CLS") to see how it works)

57 C:\Dev-Cpp\testzone1.cpp `Shield Monster::slot2' is private
108 C:\Dev-Cpp\testzone1.cpp within this context
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <windows.h>
#include "clearscreen.h" 
using namespace std;
/*Armor prevents monsters from being
destroyed and must be repaired to work
up to it's maximum capability.*/
class Armor
{
    int Weight;
    int Armor_Health;
public:
Armor(){};
~Armor(){};    
    int GetWeight(){return Weight;}
	void SetWeight(int x){Weight = x;}
	int GetArmor_Health(){return Armor_Health;} 
	void SetArmor_Health(int x){Armor_Health = x;}
	void Steel1();
};
/*Shields defend the monsters from most
damage and regenerate after each battle.*/
class Shield
{	
    int Weight;
    int Defense;
    string Resists;
    int Shield_Energy;
public:
Shield(){}; 
~Shield(){};    
    int GetWeight(){return Weight;} 
	void SetWeight(int x){Weight = x;}
	int GetDefense(){return Defense;} 
	void SetDefense(int x){Defense = x;}
	string GetResists(){return Resists;} 
	void SetResists(string x){Resists = x;}
	int GetShield_Energy(){return Shield_Energy;} 
	void SetShield_Energy(int x){Shield_Energy = x;}
	void Spectral1();
};
/*Monsters are what you use to battle and
they can hold weapons, armor, and shields.*/
class Monster
{	
    int Weight;
    int Monster_Health;
    int Monster_Armor;
    int Monster_Shields;
    int Monster_Damage;
    Armor slot1;
    Shield slot2;
public:
Monster(){}; 
~Monster(){};   
    int GetWeight(){return Weight;}  
	void SetWeight(int x){Weight = x;}
	int GetMonster_Health(){return Monster_Health;}  
	void SetMonster_Health(int x){Monster_Health = x;}
	int GetMonster_Armor(){return Monster_Armor;} 
	void SetMonster_Armor(int x){Monster_Armor = x;}
	int GetMonster_Shields(){return Monster_Shields;}  
	void SetMonster_Shields(int x){Monster_Shields = x;}
	int GetMonster_Damage(){return Monster_Damage;}  
	void SetMonster_Damage(int x){Monster_Damage = x;}
	void Level1();
};
void Armor::Steel1() 
{	
    Weight = 50;
    Armor_Health = 150;
}
void Shield::Spectral1()
{	
    Weight = 50;
    Defense = 90;
    Resists = "none";
    Shield_Energy = 100;
}
void Monster::Level1() //Default Name
{	
    slot1.Steel1();
    slot2.Spectral1();
    Weight = 50;
    Monster_Armor = slot1.GetArmor_Health();
    Monster_Shields = slot2.GetShield_Energy();
    Monster_Health = Monster_Armor + 50;
    Monster_Damage = 10;

}
inline void delay( unsigned long ms ) 
{ 
Sleep( ms );
}  
void MonsterAttack(Monster & Monster1, Monster & Monster2)
{
    //Tests if the monster's shield is equal to 0, if so damage is subtracted from health.
    if(Monster2.GetMonster_Shields() == 0)
    {Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage());}
    //Tests if the monster's shield is greater than 0, if so damage is subtracted from the shield and monster's health.
    if(Monster2.GetMonster_Shields() > 0)
    {Monster2.SetMonster_Shields(Monster2.GetMonster_Shields() - Monster1.GetMonster_Damage());
    Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage() * (100 - Monster1.slot2.GetDefense() / 100) );}
    //Tests if the monster's shield is less than 0, if so the shield's value is equal to 0.
    if(Monster2.GetMonster_Shields() < 0)
    {Monster2.SetMonster_Shields(0);}
    //Tests if the monster's health is less than 0, if so the monsters's health is equal to 0.
    if(Monster2.GetMonster_Health() < 0)
    {Monster2.SetMonster_Health(0);}
    //Tests if the monster's health is equal to 0, if so the monsters's shield is equal to 0.
    if(Monster2.GetMonster_Health() == 0)
    {Monster2.SetMonster_Shields(0);}
}
void MonsterRepair(Monster & Monster1)
{
    //Sets the monster's shield to 200.
    Monster1.SetMonster_Shields(200);
    //If the monster's health is less than 200, the monster's health will start repairing up to 200.
    while (Monster1.GetMonster_Health() < 200)
    {
    Monster1.SetMonster_Health(Monster1.GetMonster_Health()+1);
    ClearScreen();
    cout << "Repairing Monster1" << endl << endl;
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< endl;
    delay(50);
    }
}
void BattlePhase (Monster & Monster1, Monster & Monster2)//does the battle phase
{
    while (Monster1.GetMonster_Health() > 0 && Monster2.GetMonster_Health() > 0)
    {
    MonsterAttack(Monster1, Monster2);
    MonsterAttack(Monster2, Monster1);
    ClearScreen();
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << "\t";
    cout << "Monster2 Health  " << Monster2.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< "\t";
    cout << "Monster2 Shields " << Monster2.GetMonster_Shields()<< endl;
    delay(300);
    }
    MonsterRepair(Monster1);
    
}
int main(int argc, char *argv[])
{	
    Monster YourMonster1;
	Monster OpponentMonster1;
    YourMonster1.Level1();
    OpponentMonster1.Level1();
    BattlePhase (YourMonster1, OpponentMonster1);
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    return 0;
}
Try this:

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <windows.h>
#include "clearscreen.h" 
using namespace std;
/*Armor prevents monsters from being
destroyed and must be repaired to work
up to it's maximum capability.*/
class Armor
{
    int Weight;
    int Armor_Health;
public:
Armor(){};
~Armor(){};    
    int GetWeight(){return Weight;}
	void SetWeight(int x){Weight = x;}
	int GetArmor_Health(){return Armor_Health;} 
	void SetArmor_Health(int x){Armor_Health = x;}
	void Steel1();
};
/*Shields defend the monsters from most
damage and regenerate after each battle.*/
class Shield
{	
    int Weight;
    int Defense;
    string Resists;
    int Shield_Energy;
public:
Shield(){}; 
~Shield(){};    
    int GetWeight(){return Weight;} 
	void SetWeight(int x){Weight = x;}
	int GetDefense(){return Defense;} 
	void SetDefense(int x){Defense = x;}
	string GetResists(){return Resists;} 
	void SetResists(string x){Resists = x;}
	int GetShield_Energy(){return Shield_Energy;} 
	void SetShield_Energy(int x){Shield_Energy = x;}
	void Spectral1();
};
/*Monsters are what you use to battle and
they can hold weapons, armor, and shields.*/
class Monster
{	
    int Weight;
    int Monster_Health;
    int Monster_Armor;
    int Monster_Shields;
    int Monster_Damage;
    Armor slot1;
public:
    Shield slot2;
Monster(){}; 
~Monster(){};   
    int GetWeight(){return Weight;}  
	void SetWeight(int x){Weight = x;}
	int GetMonster_Health(){return Monster_Health;}  
	void SetMonster_Health(int x){Monster_Health = x;}
	int GetMonster_Armor(){return Monster_Armor;} 
	void SetMonster_Armor(int x){Monster_Armor = x;}
	int GetMonster_Shields(){return Monster_Shields;}  
	void SetMonster_Shields(int x){Monster_Shields = x;}
	int GetMonster_Damage(){return Monster_Damage;}  
	void SetMonster_Damage(int x){Monster_Damage = x;}
	void Level1();
};
void Armor::Steel1() 
{	
    Weight = 50;
    Armor_Health = 150;
}
void Shield::Spectral1()
{	
    Weight = 50;
    Defense = 90;
    Resists = "none";
    Shield_Energy = 100;
}
void Monster::Level1() //Default Name
{	
    slot1.Steel1();
    slot2.Spectral1();
    Weight = 50;
    Monster_Armor = slot1.GetArmor_Health();
    Monster_Shields = slot2.GetShield_Energy();
    Monster_Health = Monster_Armor + 50;
    Monster_Damage = 10;

}
inline void delay( unsigned long ms ) 
{ 
Sleep( ms );
}  
void MonsterAttack(Monster & Monster1, Monster & Monster2)
{
    //Tests if the monster's shield is equal to 0, if so damage is subtracted from health.
    if(Monster2.GetMonster_Shields() == 0)
    {Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage());}
    //Tests if the monster's shield is greater than 0, if so damage is subtracted from the shield and monster's health.
    if(Monster2.GetMonster_Shields() > 0)
    {Monster2.SetMonster_Shields(Monster2.GetMonster_Shields() - Monster1.GetMonster_Damage());
    Monster2.SetMonster_Health(Monster2.GetMonster_Health() - Monster1.GetMonster_Damage() * (100 - Monster1.slot2.GetDefense() / 100) );}
    //Tests if the monster's shield is less than 0, if so the shield's value is equal to 0.
    if(Monster2.GetMonster_Shields() < 0)
    {Monster2.SetMonster_Shields(0);}
    //Tests if the monster's health is less than 0, if so the monsters's health is equal to 0.
    if(Monster2.GetMonster_Health() < 0)
    {Monster2.SetMonster_Health(0);}
    //Tests if the monster's health is equal to 0, if so the monsters's shield is equal to 0.
    if(Monster2.GetMonster_Health() == 0)
    {Monster2.SetMonster_Shields(0);}
}
void MonsterRepair(Monster & Monster1)
{
    //Sets the monster's shield to 200.
    Monster1.SetMonster_Shields(200);
    //If the monster's health is less than 200, the monster's health will start repairing up to 200.
    while (Monster1.GetMonster_Health() < 200)
    {
    Monster1.SetMonster_Health(Monster1.GetMonster_Health()+1);
    ClearScreen();
    cout << "Repairing Monster1" << endl << endl;
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< endl;
    delay(50);
    }
}
void BattlePhase (Monster & Monster1, Monster & Monster2)//does the battle phase
{
    while (Monster1.GetMonster_Health() > 0 && Monster2.GetMonster_Health() > 0)
    {
    MonsterAttack(Monster1, Monster2);
    MonsterAttack(Monster2, Monster1);
    ClearScreen();
    cout << "Monster1 Health  " << Monster1.GetMonster_Health() << "\t";
    cout << "Monster2 Health  " << Monster2.GetMonster_Health() << endl;
    cout << "Monster1 Shields " << Monster1.GetMonster_Shields()<< "\t";
    cout << "Monster2 Shields " << Monster2.GetMonster_Shields()<< endl;
    delay(300);
    }
    MonsterRepair(Monster1);
    
}
int main(int argc, char *argv[])
{	
    Monster YourMonster1;
	Monster OpponentMonster1;
    YourMonster1.Level1();
    OpponentMonster1.Level1();
    BattlePhase (YourMonster1, OpponentMonster1);
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
    return 0;
}
Thanks for the help! Making the shields public fixed it.
Np xD
Also dont use dev cpp its outdated. Use Codeblocks or visual studio.
i use dev c++ because it is free, i already had it downloaded on the computer, and it takes barely any space (my computers almost full), and there isn't anything more i need.
Last edited on
Code:Blocks and VS Express is free too and Code::Blocks + MinGW does not take much space.
Dev C++ is extremily oudated, violates standard in some cases and does not support C++11.
I haven't done c++ in over half a year (and i'm only 17, do this for coding knowledge), how is it "extremely" outdated, how does it violate standard, and what is new about c++11
Last official version of dev-C++ was released in 2005. Version of MinGW GCC it uses is notorious for numerous bugs and it does not support latest standard which was released in 2011. That means that much of the recently written code will not work with your compiler. If you want similar looking IDE, you can look at Eclipse. Code::Blocks can do this too, but you might need to acustomise with it first.
I started self-teaching myself coding maybe 2 years ago, and i have yet to run into a problem with dev c++, i don't know what does not work, with dev c++, that i would use, that works in other compilers.
Last edited on
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
#include <iostream>
#include <chrono>
#include <thread>
#include <future>

std::string async_input()
{
    std::string temp;
    std::cin >> temp;
    return temp;
}

void timer()
{
    using std::chrono::steady_clock;
    using std::chrono::seconds;
    using std::chrono::milliseconds;
    steady_clock::time_point schedule = steady_clock::now() + seconds(5);
    std::cout << "Timer will tick every 5 seconds" << std::endl;
    while (true) {
        auto inp = std::async(std::launch::async,async_input);
        while (inp.wait_for(seconds(0)) != std::future_status::ready) {
            if (steady_clock::now() >= schedule) {
                std::cout << "tick" << std::endl;
                schedule += seconds(5);
            }
            std::this_thread::sleep_for(milliseconds(100));
        }
        if (inp.get() == "stop")
            break;
    }
}

int main()
{
    std::thread m(timer);
    m.join();
}

Try this. It is basic threaded program.
Are you sure that you have dev-C++? Not one of the forks <something> dev-C++? They are actually quite different.
ill try that and see if it works although i have no idea what
1
2
3
#include <chrono>
#include <thread>
#include <future> 
do

and yes i have dev c++
http://www.bloodshed.net/dev/devcpp.html
Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2
Last edited on
#include <chrono> Basic time manipulation
#include <thread> Basic threading
#include <future> Asynchronous function calls and delayed result taking.
Also there is Orwell dev-c++. A little behind on new features, but have dev-c++ interface. And you can add newer MinGW version manually.

Also very basic features:
1
2
3
4
5
6
7
8
9
10
11
12
#include <array>
#include <algorithm>
#include <iostream>

int main()
{
    std::array<int, 5> arr{1,2,4,6,3};
    auto minmax = std::minmax_element(arr.begin(), arr.end());
    std::cout << *(minmax.first) << ' ' << *(minmax.second) << std::endl;
    for(auto i: arr)
        std::cout << i << ' ';
}

Last edited on
Your Program

\Dev-Cpp\testprog.cpp C:\Dev-Cpp\C chrono: No such file or directory. 
\Dev-Cpp\testprog.cpp C:\Dev-Cpp\C thread: No such file or directory. 
\Dev-Cpp\testprog.cpp C:\Dev-Cpp\C future: No such file or directory. 
 C:\Dev-Cpp\testprog.cpp In function `void timer()': 
15 C:\Dev-Cpp\testprog.cpp `std::chrono' has not been declared 
15 C:\Dev-Cpp\testprog.cpp expected nested-name-specifier before "steady_clock" 
15 C:\Dev-Cpp\testprog.cpp `steady_clock' has not been declared 
16 C:\Dev-Cpp\testprog.cpp `std::chrono' has not been declared
16 C:\Dev-Cpp\testprog.cpp expected nested-name-specifier before "seconds" 
16 C:\Dev-Cpp\testprog.cpp `seconds' has not been declared 
17 C:\Dev-Cpp\testprog.cpp `std::chrono' has not been declared 
17 C:\Dev-Cpp\testprog.cpp expected nested-name-specifier before "milliseconds" 
17 C:\Dev-Cpp\testprog.cpp `milliseconds' has not been declared 
18 C:\Dev-Cpp\testprog.cpp `steady_clock' has not been declared 
  (Each undeclared identifier is reported only once for each function it appears in.) 
18 C:\Dev-Cpp\testprog.cpp expected `;' before "schedule" 
21 C:\Dev-Cpp\testprog.cpp ISO C++ forbids declaration of `inp' with no type 
21 C:\Dev-Cpp\testprog.cpp `async' is not a member of `std' 
21 C:\Dev-Cpp\testprog.cpp `std::launch' has not been declared 
21 C:\Dev-Cpp\testprog.cpp `async' undeclared (first use this function) 
22 C:\Dev-Cpp\testprog.cpp `wait_for' has not been declared 
22 C:\Dev-Cpp\testprog.cpp request for member of non-aggregate type before '(' token 
22 C:\Dev-Cpp\testprog.cpp `seconds' undeclared (first use this function) 
22 C:\Dev-Cpp\testprog.cpp `std::future_status' has not been declared 
22 C:\Dev-Cpp\testprog.cpp `ready' undeclared (first use this function) 
23 C:\Dev-Cpp\testprog.cpp `steady_clock' has not been declared 
23 C:\Dev-Cpp\testprog.cpp `now' undeclared (first use this function) 
23 C:\Dev-Cpp\testprog.cpp `schedule' undeclared (first use this function) 
27 C:\Dev-Cpp\testprog.cpp `std::this_thread' has not been declared 
27 C:\Dev-Cpp\testprog.cpp `milliseconds' undeclared (first use this function) 
27 C:\Dev-Cpp\testprog.cpp `sleep_for' undeclared (first use this function) 
29 C:\Dev-Cpp\testprog.cpp `get' has not been declared 
29 C:\Dev-Cpp\testprog.cpp request for member of non-aggregate type before '(' token 
 C:\Dev-Cpp\testprog.cpp In function `int main()': 
36 C:\Dev-Cpp\testprog.cpp `thread' is not a member of `std' 
36 C:\Dev-Cpp\testprog.cpp expected `;' before "m" 
37 C:\Dev-Cpp\testprog.cpp `m' undeclared (first use this function)

also i see you could have used namespace std; (save abunch of typing)
and i think for some of the tasks you could have used windows.h and ctime

for example
delayed result taking

millisecond function
1
2
3
4
inline void delay( unsigned long ms ) 
{ 
Sleep( ms );
}  


dont know what this program was supposed to actually do but it does not work in dev c++, and uses libraries i don't know
Last edited on
As I told you, it isn't supporting C++11.
Try even simplier example I posted and get rid of that relict of the past you ar using now.

Also read about some useful features of C++11:
http://www.cprogramming.com/c++11/c++11-ranged-for-loop.html
http://www.cprogramming.com/c++11/c++11-auto-decltype-return-value-after-function.html
Last edited on
used namespace std
DO not do that in anything above Hello World level programs. It will introduce a whole bunch of extremely difficut to find bugs. Especially when dealing with <algorithm>
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
http://stackoverflow.com/questions/4043930/is-using-namespace-like-bad

uses libraries i don't know
You should, if you ever will deal with time and duration. Or write programs which make use of multicore processors.

If you want to only write small programs for your own amusement and withot any practical use it is fine. But if you want to do something more, you should move on. At least move to Orwells fork.
Last edited on
Pages: 12