MinGW on Windows 8 - windows

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

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.

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?

#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! :)

Related

"Hello world" Fortran (gfortran) fails to run in Windows 8.1

I have the following code:
PROGRAM TEST
IMPLICIT NONE
PRINT *, "test"
END PROGRAM TEST
It is compiled successfully using this command:
C:/cygwin64/bin/x86_64-w64-mingw32-gfortran.exe test.f08 -o test.exe
When I run the program by double clicking it, it produces the error:
"The application was unable to start correctly (0xc000007b). Click OK to close the application."
The file libgfortran-3.dll is in the same folder as the executable. My environment is Windows 8.1 64-bit. Cygwin (Setup.exe version 2.850 (64 bit)) is installed to C:\cyginw64. All defaults packages were installed, along with all "Base" and "Devel" packages. My system PATH environment variable includes C:\cygwin64\bin. Running the program from the Cygwin64 terminal produces no output.
What is causing this error? I have another, more complicated program that suffers from the same error.
Possibly related: why gfortran under cygwin can't compile correctly?
That error code is an NTSTATUS code, specifically STATUS_INVALID_IMAGE_FORMAT. Almost without fail that means you are trying to load a 32 bit module into a 64 bit process. Or vice versa. Use a dependency analysis tool to work out which module has the wrong bitness. For example Dependency Walker.

i386 exe file that refuses dosbox, on x64 windows

I am trying to make a code run on my machine (windows 7 x64), it is a fortran 90 code that needs a third-party provided i386-based dll to work.
When I tried compiling it (with latest gfortran and mingw) to a x64 target, it refused, because of the i386 dll file. Then, I tried to compile it to a i686 target, and the compilation worked without errors.
However, the output a.exe file won't run on my x64 windows (as one could expect), and when trying to run it from Dosbox (just typing "a" or "a.exe" when I reached the correct directory), I just got "this program cannot be run in DOS mode".
So my question is: is it a fail in the compiling process, or does Dosbox reject the program for some reason (the reason being possibly that the "a.exe" program needs to write to a file when executed: it is its purpose, actually!), and if it is so, what is the reason, and is there a way to ultimately see my exe file run? on my machine?
EDIT: Dosbox indeed can run a 32 bit exe file I have from another project, so it is not Dosbox being completely non-functional. However, when trying to open that exe file directly with windows 7, it says it is incompatible with x64, while for the other file (a.exe) it just says it "fails to initialize" with code "0xC000007b"...unfortunately my compiler debugging knowledge is close to zero...
Thank you very much for your help!

OpenSSL on 64bit Windows

I am trying to build and link OpenSSL on Windows 8 and I've found it really daunting. I should mention that I am aware of following posts
OpenSSL Windows x64 Compilation error
How do you compile OpenSSL for x64?
Building OpenSSL VC++ Static 64bit Libs
but none of them addressed what I do really need to know. Therefore I decided to share my experience with you guys as a new post!
First, I can successfully build and link OpenSSL on a Win32 OS and it perfectly works. I know that Windows 8 comes with WOW64. “WOW64 is an x86 emulator that allows 32-bit Windows-based applications to run seamlessly on 64-bit Windows”, though when I run my app that is built on windows 7 32-bit, I receive an error “The program can’t start because libeay32.dll is missing from your computer…” while “libeay32.dll” is apparently there and not missing.
In order to avoid registry missing stuffs, I tried to build OpenSSL in 32bit mode on Windows 8. The build was successfully done and the app linked correctly with no error. Again when I run the app I received the same error message.
And then I tried to build it in 64bit mode based on the following steps;
set PATH=%PATH%;c:\perl\bin;c:\nasm;
call "c:\visual studio\2012\vc\vcvarsall.bat" x64
perl Configure VC-WIN64A no-shared no-idea
call ms\do_win64a
copy ms\libeay32.def ms\libeay64.def /Y
copy ms\ssleay32.def ms\ssleay64.def /Y
ssed -e s/out32/out64/g ms\ntdll.mak | ssed … > ms\ntdll-64.mak
ssed -e s/out32/out64/g ms\nt.mak | ssed … > ms\nt-64.mak
nmake -f ms\ntdll-64.mak
nmake -f ms\ntdll-64.mak test
nmake -f ms\ntdll-64.mak install
In this case, I received a lot of warnings mostly on “data conversion and possibility of data loss” during build but it was built and while “test” failed “install” generated outputs.
Now when I try to build my solution in Visual Studio using new “libeay64.lib and ssleay64.lib” I receive almost thousands of errors saying “unresolved external symbol”
So if possible please answer following questions;
Why I cannot run my 32bit app on Windows 8 (64bit)?
Why correctly built OpenSSL (32bit mode) on Windows 8, still
encounters same error?
In OpenSSL build (64bit mode), am I making something wrong?
I am using OpenSSL ver 1.0.1e, Visual Studio 2012 and nasm 2.10.07
Thanks
I am partially answering your question:
You can run 32-bit under 64-bit in WOW64.
For OpenSSL under 64-bit, there is a compiler option /WX under visual studio which means treat warnings as an error. Remove that compiler option from the makefile. You will get lots of warnings. But OpenSSL will get compiled.
Since, most of the modules are not compiled and their object file is not generated, that is why you are getting linker error. Please let me know if it solves your problem.

Getting vc++ 2010 code to compile on ubuntu

i have made a program in vc++ 2010 in win7 but since the submission asked for a unix executable file i got ubuntu and am unable to compile to the program. i give the command:
gcc (filename) -o (submission file)
and i am getting a lot of errors as someone guided me over this site that vc++ code will be entirely supported in ubuntu. Then why is the problem? what is the solution?
also if any ide is needed can i use mu code block of windows for ubuntu as well?
You should be using g++ instead of gcc, also VC++ code may or may not work depending on what the submission is required to do as Windows has different libraries for certain things. Try using g++ instead and edit your errors into the question so we can help better.

OpenCV 2.2 Windows XP MinGW build crashes on namedWindow, imshow

I downloaded the latest OpenCV 2.2 sources for Windows and compiled on Windows XP using MinGW 4.4.1, with the help of CMake 2.8.
Everything went smoothly and compilation (mingw32-make) and installation (mingw32-make install) completed successfully.
However, when I compile some code containing namedWindow() and imshow() functions of highgui, it compiles but the program crashes. The following single line of code crashes:
namedWindow("img", CV_WINDOW_AUTOSIZE);
The sample programs coming with OpenCV, displaying images, also crash.
Have anyone experienced the same problem, and do you have a solution?
I have also compiled and am using OpenCV 2.2 on linux (Ubuntu) without any problem.
Thanks a lot.
I've the same problem. I built OpenCV 2.2 under WindowsXP, using CMake, MSYS-make and mingw.
The sollution is explained here: mingw32 SSE/SSE2 instabilities
What I have done is the following:
Use CMake (2.8.4), specify target directory and run "Configure" for MSYS's make.
Type Debug at "CMAKE_BUILD_TYPE".
Remove checkmark for "SSE2".
Run "Configure" again.
Run "Generate".
Run make at target directory.
Run make install.
This worked for me.

Resources