A possible duplicate of Entry point not found when running exe
Recently, I installed MinGW and I was following some examples shown in "C++ in Easy Steps". I was working through it, and I got on to the section about classes.
It told me to enter this code so here it is:
#include <string>
#include <iostream>
using namespace std;
class Dog
{
int age, weight ;
string color ;
public:
void bark() { cout << "WOOF!" << endl ; }
void setAge( int yrs ) { age = yrs ; }
void setWeight( int lbs ) { weight = lbs ; }
void setColor( string hue ) { color = hue ; }
int getAge() { return age; }
int getWeight() { return weight; }
string getColor() { return color; }
} ;
int main()
{
Dog fido ;
fido.setAge( 3 ) ;
fido.setWeight( 15 ) ;
fido.setColor( "brown" ) ;
cout << "Fido is a " << fido.getColor() << " dog" << endl ;
cout << "Fido is " << fido.getAge() << " years old" << endl ;
cout << "Fido weighs " << fido.getWeight() << " pounds" << endl ;
fido.bark() ;
return 0 ;
}
I compiled it successfully (cmd: c++ object.cpp -o object.exe
)
And I executed (cmd: object
) it and came up with this error message:
What did I do wrong?
I've noticed that it is just programs with classes that have this problem, because I can run programs without classes, just with them is the issue.
Edit:
It is different from the above question, because I already have my PATH
Environmental Variable set to C:\MinGW\bin
:
The accepted answer says:
Locate the directory containing libstdc++-6.dll and add it to your PATH variable.
- Open command prompt
- Run set PATH=%PATH%;YOUR_PATH_HERE
So am I doing it right?