September 25th, 2003, 10:27 AM
Problems transferring C++ executable files on another machine
I created some executable files out of a particular Code using Turbo C++. Those executables were working fine when i checked on my machine in any path besides the normal working folder. When i transferred those files to another machine which does not have turbo C++ in it then it doesn't run properly. why is this happening ideally the executables should work fine in any machine with or without C++ on it.
Plss let me know as soon as possible
Thanks so much
September 25th, 2003, 10:43 AM
I forget whether Turbo C++ has this option, since I haven't used it for a decade now, but I seem to recall that you had the option of statically or dynamically linking the run-time libraries to your executable.
As a matter of fact, most compilers seem to offer this, including gcc on Linux. If you have several programs that all use the same run-time library (RTL), then statically linking the RTL into each and every one of them would make all of them larger and would eat up more disk space and RAM (in an OS where you could have several of these programs running concurrently). To save space, especially in RAM for concurrently running programs, you would want them to link to the RTL dynamically so that you only need to load in one copy of the RTL -- DLLs in Windows and shared libraries in Linux to the same thing.
Of course, that means that you need to have the RTL loaded in any computer that you try to run the program on. The alternative for running a program on a computer that doesn't have the RTL is to link the RTL statically, so that it is included as part of the .EXE file.
Look at your linker options (sorry, I forget where that's hidden). You will probably find that dynamic linking/binding is selected. Select static (or "early binding") and see if that works.
You should also read the manual about linking/binding. In those days, Borland's documentation was fairly good.