tags:

views:

75

answers:

3

Hi, i am very new to unix/linux/c which i guess is why i am in this predicament.

Anyway, i have just completed a c programme assignmnet and am trying to run it from linux terminal. So far i can create the main programme by

navigating to the folder running gcc myFile.c then doing .a/.out

this then runs my programme from the terminal window. Thats fine, however to test our output out teacher gave us another file - i guess it has certain conditional checks to tets our outputs are correct. On inspection it appears to be a .exe file with the name myFile_ok.exe

to run it i have tried to do the above steps

navigating to the folder doing ./myFile_ok.exe

but i get an error saying myFile_ok : cannot execute binary file

Any ideas how i actually can run this file at all?

Thank you

edit: there is also a make file if that makes answering my question any easier?

+2  A: 

You'll have to use wine or mono to run it, since it's not a Linux executable. Run file against it to be sure.

Ignacio Vazquez-Abrams
If it is a linux executable you could go "sh myFile_ok.exe"
leonm
could you provide me with an example of how to do this please, i appreciate it maybe considered spoon feeding me solutions but i have done the hard graft of getting my programming done, i just want to check it tbh ! :D
sbsp
"file myFile_ok.exe" - will tell you what kind of file it s. "wine myFile_ok.exe" will potentially run the program if it is a windows executable (sometimes wine can run an exe with no problems, sometimes not)
Justin Smith
"Run file against it" means type `file myFile_ok.exe` in the shell and examine the output.
dmckee
+1  A: 

If the filename ends in .exe it is most likely a Windows executable, which you would not be able to run under Linux. (Maybe you could run it under Wine but that's probably beyond the scope of your assignment).

Probably easier to recompile your program on a Windows PC and test there. If you get Cygwin you can still compile with gcc.

Dan
A: 

Put the makefile in the same directory as the c file and run make in the terminal. The makefile means that you shouldn't have to worry about the compilation steps - it'll just do it for you.

Skilldrick
it just printed the followinggcc -g -Wall -c -o myFile.o myFile.cgcc -g -Wall -o myFile myFile.o
sbsp
Is there anything else in the directory now?
Skilldrick
a .o file that wasn't there before
sbsp
That run of make almost certainly didn't make an `a.out`. It should have made `myFile.o` and `myFile` (the latter being an executable).
dmckee