简体   繁体   中英

C++, The system cannot execute the specified program

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;
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM