2

I wrote a simple c program in TurboC+ in my pc.[windows 8 x64].

I compiled it and ran it's without having any error. But after make the exe file tried to run it. But i got a error saying that "The app can't run on your pc. To find a version for your Pc, check with the software publisher."

Why did i get this error?

And after that i wrote my simple c program in Visual Studio 2008 and i compiled and ran it. And build the exe file.

The exe file runs in my pc. But when i try to run the same exe file in my laptop it shows sow error. I googled the error and somebody wrote that i have to build the exe in release mode. And he said that i can change the mode in configuration manager. But i couldn't find anything in my visual studio 2008.

Can somebody explain me about the Debug and Release things! Please.

I'm really confused about this.

And I'm a beginner in programming. So i don't know much about these stuffs.

Thank you.

MaxySpark
  • 555
  • 2
  • 10
  • 26
  • Don't use Turbo C++, it is ancient. *Debug* contains additional information to assist in debugging and links to DLLs that are not deployed to general users. A *Release* build *still* needs any additional run-time support (vcredist) for that version of the compiler if not already installed. – crashmstr Sep 16 '14 at 14:41
  • The "compile" in C is done for the exact processor you have on your machine. That's why trying to execute the same executable in an other machine will probably not work. You have to re-compile it for the new machine. – billpcs Sep 16 '14 at 14:43
  • Windows 8 64 bit @Klas Lindbäck – MaxySpark Sep 16 '14 at 14:43
  • @crashmstr tell me any other software that i can used instead of TurboC++ – MaxySpark Sep 16 '14 at 14:52
  • 1
    http://en.wikipedia.org/wiki/List_of_compilers#C_compilers – Jens Mühlenhoff Sep 16 '14 at 14:54
  • Please note that Turbo C++ is ambiguous, it could be the old MS-DOS compiler or it could be the "Turbo Edition" of Embarcadero C++ Builder: http://www.embarcadero.com/products/cbuilder. – Jens Mühlenhoff Sep 16 '14 at 14:57
  • @MaxySpark Visual Studio 2008? Sounds like you already have it. You can also look into [Visual Studio Express](http://www.visualstudio.com/en-US/products/visual-studio-express-vs) as well as open source compilers and IDEs. – crashmstr Sep 16 '14 at 14:58
  • @JensMühlenhoff I'm not seeing any reference to anything named "Turbo" on that page. As another point, it seems like many schools in India do still use the ancient Borland products. – crashmstr Sep 16 '14 at 15:02
  • @crashmstr actually we used Ubuntu or Fedora in college. But in my home i have no linux base pc. So I did use TurboC and Visual studio. :( – MaxySpark Sep 16 '14 at 15:08
  • We're confused too because you failed to provide verbatim error messages. We could guess but should not have to. – David Heffernan Sep 16 '14 at 15:26
  • @crashmstr http://www.turboexplorer.com/downloads Though your probably right, it could be the old Turbo C product, but how does it even *run* on Windows 8 x64? – Jens Mühlenhoff Sep 16 '14 at 16:05
  • Somebody vote down my question. Again i loose talk in chat privilege. May be i should delete my question. :'( – MaxySpark Sep 16 '14 at 16:57

1 Answers1

2

First of all C executables are platform dependent which means that you can't run for example an executable compiled for x64 on a x86 processor. (The reverse may work, but that is a special case.)

Also you can't run an executable compiled for Linux on Windows, etc.

The second part of the problem is that your compiler has a standard library (VC runtime or libc, etc.) that can be either statically or dynamically linked with your executable. If it is dynamically linked you have to distribute the standard library alongside your executable.

http://askleo.com/do_i_need_these_microsoft_visual_c_redistributables/

The Release vs. Debug configuration may or may not have anything to do with the runtime being statically or dynamically linked that depends on the compiler and configuration used. You'd have to read the manual for your compiler.

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • Is there any easy way to build the exe file that it can be run in other pc. – MaxySpark Sep 16 '14 at 14:49
  • 1
    Maybe you should read this question: http://stackoverflow.com/questions/14749662/microsoft-visual-studio-c-c-runtime-library-static-dynamic-linking – Jens Mühlenhoff Sep 16 '14 at 14:52
  • TurboC is probably producing a 16 bit executable – David Heffernan Sep 16 '14 at 15:27
  • I got here how to add configuration manager to a basic project. http://msdn.microsoft.com/en-us/library/ms228736(v=vs.90).aspx And got here how to make exe file that can run in other pc. http://www.codeobsessed.com/code/viewtopic.php?t=39& But still don't know what is Debug and Release. :) Is there any way to install ***Ubunto*** in my windows 8 64bit laptop. – MaxySpark Sep 16 '14 at 15:27
  • You mean `Ubuntu`? Yes, that is most likely possible. You have to be a bit more specific (as others have written) in what you are actually trying to do (e.g. what OS are the *other* PCs running, what compilers are you actually using, what are the *exact* error messages). – Jens Mühlenhoff Sep 16 '14 at 15:57
  • @DavidHeffernan OP is running x64 Windows so I don't think it's a 16-bit executable, but without exact error messages it's hard to know what's really going on. – Jens Mühlenhoff Sep 16 '14 at 15:58
  • 16 bit executables don't run on 64 bit Windows. Perhaps Turbo C++ is a 32 bit program that emits 16 bit executables. – David Heffernan Sep 16 '14 at 16:04
  • @DavidHeffernan As far as I remember Turbo C++ was a DOS program (which doesn't rule out 32 bit executable of course with DOS extenders and protected mode, etc.) and cross compiling is something that's also part of the picture, too. One could expand my answer into a thick book I guess ;). The question is just too broad / unspecific. – Jens Mühlenhoff Sep 16 '14 at 16:11
  • Sorry. It would be Ubuntu. – MaxySpark Sep 16 '14 at 16:26
  • After compiling in **turboc** https://onedrive.live.com/download?resid=E63780628DD96583!3361&authkey=!AJWTDc0N1-zfh4g&v=3&ithint=photo,jpg After make the exe file trying run the file. Got this error https://onedrive.live.com/download?resid=E63780628DD96583!3362&authkey=!AHNMpio67__Q_ZM&v=3&ithint=photo,jpg My windows os version https://onedrive.live.com/download?resid=E63780628DD96583!3363&authkey=!ADTOvYG8i0jX4EE&v=3&ithint=photo,jpg – MaxySpark Sep 16 '14 at 16:53
  • @MaxySpark Ok, so you are using an *ancient* version of Turbo C (from before year 2000) that is not capable of producing 32-Bit Windows programs. – Jens Mühlenhoff Sep 16 '14 at 17:46
  • 1
    I would suggest either using Microsoft Visual C++ or Dev-C++ http://orwelldevcpp.blogspot.de/ or Code::Blocks http://www.codeblocks.org/ or the current Embarcadero C++ Builder. – Jens Mühlenhoff Sep 16 '14 at 17:48
  • 1
    That is, if you want to write Windows software. For Linux the situation is differnt, there are lots of Linux IDEs as well (Anjuta, KDevelop, Geany, etc.) and they usually use either GCC http://gcc.gnu.org/ or Clang http://clang.llvm.org/ as their compiler – Jens Mühlenhoff Sep 16 '14 at 17:50
  • 1
    You can also produce Windows executables from Linux using a so called cross-compiler http://mingw-w64.sourceforge.net/, but that is a rather advanced topic. – Jens Mühlenhoff Sep 16 '14 at 17:51