Reputation: 135
so I am new to C++ and recently I have been playing around with structures. I have this code below. This does not give me an error when I compile it but when it runs, it says "The system cannot execute the specified program." I have no idea why. I tested this code on my friend's computer and it works for him and when I deleted a member variable inside the struct the code runs perfectly. Also, when I initialize the object right before the ; in the end of the struct, my code works. But only with this specific layout my code doesn't work. I am not really sure why this is wrong. Thanks!
#include <iostream>
using namespace std;
struct bob {
int num1;
int num2;
int num3;
};
int main() {
cout << "Sup" << endl;
bob test;
test.num1 = 10;
test.num2 = 20;
test.num3 = 30;
return 0;
}
Upvotes: 0
Views: 12932
Reputation: 49
I hope you have found a solution to this problem so far.Still I would like to share my experience. I had the same problem , when I was trying to execute my c program's executable file in windows 10 pc. Then I came up with the idea to uninstall the antivirus which were restraining the executable file to execute. eventually that was the solution of this problem.
Upvotes: 4