My .exe file won't run if the file I compiled is .h type.
This is the C++ code I put:
#include <iostream>
using namespace std;
int main(){
int var = 0, sum = 0;
while (std::cin >> var){
sum += var;
}
std::cout << "sum " << sum << std::endl;
return 0;
}
I use MinGW for compiling, and I named the file CTesting.h and compiled it and I get the following error running the exe:
The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether your need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.
I do not get this error when I rename the source fill to a .cpp type. It is my understanding that C++ used .h and .cpp files, is that incorrect? or am I doing something wrong/forgetting something?