Reputation: 31754
My OS is windows 8 and I am using MinGW version 4.6.1. When I compile using gcc
it compiles well. But on running it throws the below error:
This version of C:\Users\danish\Documents\a.exe is not compatible with the versi on of Windows you're running. Check your computer's system information and then contact the software publisher.
Is there any stable version out there for Windows 8? or any other substitutes
Upvotes: 0
Views: 6748
Reputation:
@Jatin, I faced that same problem as yours. What I did was, I wrote a program in notepad++ and then saved it as a cpp file. Hence it was assigned a default extension of ".h". Now whenever I compiled it using g++, a 32 bit exe was created which threw the same error you mentioned above. What I did to overcome the above problem was, I manually changed the extension of the file to ".cpp" and then complied it. In this case, a 64 bit exe file was created which ran successfully thereby displaying the correct output.
I agree that this does not solve the issue, but it surely provides a work around. Hope this helps! :)
Upvotes: 0
Reputation: 566
The earliest version of gcc I have available for testing is 4.6.3. It works just fine for me on 64-bit Windows 8.
// -*- compile-command: "gcc -o test.exe test.cpp"; -*-
#include <stdio.h>
int main ()
{
puts ("Hello, World!");
}
Output: "Hello, World!".
Perhaps you are using a gcc that targets 64-bit Windows, then running the program on 32-bit Windows. What does gcc -v 2>&1 | find "Target:"
output? What does systeminfo | find "System Type"
output?
Upvotes: 1
Reputation: 1049
Use mingw32-gcc.exe to compile your source code rather than gcc.exe. I don't know whether it works because I don't have a Windows 8, but you can try it anyway.
Upvotes: 1