Hey guys. I am using windows xp, and Bloodshed Dev C++ compiler.
I am making a simple program.
The CPP file and EXE file work fine on my computer, but do not work on any other computers, no matter what OS (Ive tried on xp, vista, linux and 7).
When the exe is run, after a short time, an error message comes up saying "CMDME.exe" has stopped running.

Now, I have made other programs that work perfectly on my computer, and all others, so it's not the compiler, and I have recompiled it many times, so the file is not corrupted.

Anyone have any clues as to what is happening?


Here's a list of the #includes:

#include<iostream>
#include<string>
#include<unistd.h>
#include<sys/types.h>
#include<dirent.h>

if that helps anyone.

Cheers.

assuming that all you did was copy and paste the code to a new file, all i can say is that you either named the file something that the computers did not like, you saved it as something other than an exe, maybe you do not have all of your other files (.h files) in the same folder, or not in the right directory or some were misnamed, but thats just my thought... or the other O/Ss just didnt like you :'(
ive just been learning c++ over the summer, this was my last week... so im probably wrong but i thought i might try to help cuz im restless rite now >_<

C++ executables can't be executed on "another" OS. So an executable that you compiled in Linux won't run in Windows and vice versa. This is widely advertised as one of the strong points of Java... compile once run anywhere with a JVM. Also, if I remember correctly then some processor/hardware specific optimizations may prevent an executable from running on a different system.

As Necrolin has stated, a program built on Windows will not run in Linux (without something like Wine! ;) ), likewise a program built on Linux will not run on windows (without something like Cygwin!)

But if you compiled it on Windows, the resultant .exe should work on other windows machines regardless of the version (well more or less! There are some cases where it wouldn't!)

As you compiled your program on XP it should at least run on another machine with XP.

I'm not sure of the dependencies of .exe's built with DevC++, but if you create an .exe with Visual Studio, especially if you've used the MFC, the .exe will require the msvcrxx.dll in order to run.

xx relates to the version of VS used to compile the program. So an .exe created with VS2003 could require the msvcr70.dll, VS2005 .exe's need msvcr80.dll, VS2008 .exe's need msvcr90.dll.

If another windows machine doesn't have the appropriate .dll installed and the .dll isn't packaged alongside the .exe (or in your installer) then your program will not run on that machine.

Now as I've said, I don't know if .exe's built with DevC++ have any particular .dll dependencies like VS, but if they do and your other windows machines do not have those .dll's installed then that could possibly explain the problems you're having....

Similarly, if you are using any other third party libraries or .dll's in your code; if your target machine does not have those .dll's installed your program will not work.

But then having said that.. If that was the case, I'd expect you to get some kind of .dll related error when you try running your program on other windows machines.

Offhand, I can't think of any other issues that could cause problems like this. But if I do think of anything I'll post again!

Anybody else got any ideas?

Cheers for now,
Jas.

One other thing has sprung to mind....

If your program is actually running for a while before it bombs out, it's almost certainly a bug in your code.

If it works on your machine and not any others, is it possible that you have hard coded something into your program which is specific to your machine?....Like perhaps a file-path or something??

Taking the filepath as an example:
Say your program needs to use a file like...
C:\somefolder\somefile.txt

Your machine has a folder on the root of c: called somefolder and contains the appropriate file, but your other windows machines do not.

OK so, you run your program on your XP machine, it finds the file and does whatever it needs to do...ok, fine!
Now you run it on another XP machine....One that does not have the appropriate folder/file...
Perhaps as well as hard coding the path, perhaps when opening the file, you've not put a check in your code to ensure that the file opened ok before attempting to do something with it....
Your program then tries to access the non existent/non opened file and the program crashes..

OK, This is merely a possible scenario. Conjecture if you will, but it's an example of something that could cause problems!

Take another look at your code and see if there is anything which is specific to your machine hard coded in there and then try to make it more generic. And make sure that you make any necessary checks to ensure that things are opened properly, pointers are valid etc.

If you can't see anything, or you are having any more trouble, perhaps zip up your code and attach it to another message in this thread so a few of the coders here could cast their eyes over it!

Cheers for now,
Jas.

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.