I have created a sample program on C.When i try to run on a different system (win 7 64 bit) it is asking for x64 version of the file (of the executable file created ).

P.S. - I am not talking about the compiler, but about the executable file created after compiling.
P.S.3 - again the .exe file .....hehe lol ...

PLZ help..
thanx in advance

Recommended Answers

All 6 Replies

This depends on which compiler you are using.

If you use Visual Studio (presumably on a 32bit Windows), then you can install a 64bit cross-compiler (and the necessary auxiliary tools and libraries), as it says here. Of course, if you use a version of Visual Studio that is older than 2008, then you really should update it, because, as far as I'm concerned, any version prior to 2008 is completely unusable (too sub-standard, poor performing, and feature-deprived).

If you are using MinGW (GCC), then you need to use MinGW-w64 which is a fork for mingw that supports both 32bit and 64bit for both host (what you are running on) and target (what you are compiling for).

If you are using any other Windows compiler (Intel? IBM? Borland?), then you would have to check with those vendors what is possible.

Needless to say, if you are not working under Windows (e.g., you are working in Linux or Mac OSX), then this is impossible because these systems use completely different executable formats ("ELF" format, for all Unix-like systems), so, obviously that won't work in Windows. I don't know of any easy way to compile Windows executables from a non-Windows system (i.e., a Unix-like system), I suspect that setting this up is not for the faint of hearts.

i am using turboc . Any other compiler you would suggest to handle this problem?

and i am using win 7 64 bit.

commented: code::block or Devcpp is great +0

Aaaaannnddd there's your problem. Everyone give a warm round of applause and +1's to Mike for an excellent response.
However, once again, we ...
I don't even know how to put this gently to the OP:
Don't frakking use Turbo C.
OK, let's qualify that statement with: Don't use Turbo C outside a DOSBox instance, and even then, only use it to explain the history of programming to someone else or for your own personal sick amusement (guilty!).
But for actual programming there are better options and this question has been answered several, several times.


Stop using Turbo C.
Go get Visual Studio Express or Code::Blocks or the Qt SDK or Orwell Dev C++.

The executables created by Turbo C are totally incompatible with 64 bit operating systems.
On 64 bit Windows you should be able to run both 32 and 64 bit executables, you just need a non-prehistoric compiler to produce the executable.
Look into MinGW (GCC) and Visual Studio as already mentioned by Mike.

I see people using Turbo C++ sometimes, but this might be my first spot of plain Turbo C in the wild :p

For the history buffs, the last version of Turbo C was released in 1989, and made 16 bit executables for DOS.

For those to whom that means nothing, DOS was a kind of operating system we had before you were born :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.