Sunday, July 12, 2009

How to use a c++ exe file from linux in windows?

I have a c++ code in linux. In this code I call another code and I run it. The exe file for this other code is called "voronoi" and I need to give it as input "b.txt". The output will be called HEXAGON.txt . For this I use the command:





system("/.voronoi %26lt;b.txt %26gt;HEXAGON.txt");





now the problem is that I have another c++ code in windows and I need to call "voronoi" in this code aswell but I don'y know how to do it. I have copied voronoi into the folder of this code but it doesnt work. Please help.

How to use a c++ exe file from linux in windows?
It is better to have the source code voronoi to make the program portable and faster, I should say. So I would recommend you finding another source code implementation for voronoi.





As indicated earlier, the executable formats are different in Windows and linux, so you would need to use to use an emulator like Cygwin. Using Cygwin, you can run linux executables in Windows environment.
Reply:Don't. Linux uses the ELF file format for its executables. Windoze uses the exe and com formats for its executables. If you want to run voronoi under Windoze you copy the source code to your Windoze HD and download either djgpp or DevC++ (at http://www.delorie.com/djgpp and http://www.bloodshot.net/dev-cpp.html ) and recompile it as an exe file. Both are Windoze ports of GCC.





If your computer can ever ever forgive you for leaving Windoze on it, it will thank you for not mixing file formats that way.
Reply:At a guess I say the problem was to do with the '/.' part of you system command. Windows and Linux will treat this differently. With the syntax you've used I think it would try to find voronoi in the the root directory of the current drive.





I'd copy voronoi into some directory that is in PATH and then call it with -





system ("voronoi %26lt;b.txt %26gt;hexagon.txt");





I create a C:\Bin folder to do this.

gerbera

No comments:

Post a Comment