0

This question already has an answer here:

I have recently compiled a .CPP file with Geany. The result file is a .o file. How can I run this .o program?

marked as duplicate by Pilot6, karel, Fabby, Eric Carvalho, A.B. Sep 1 '15 at 18:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4

You usually can't run a .o (object code) file directly: it lacks the necessary library linkage.

Instead of Compile, you need to Build (Geany shortcut F9 rather than F8). This will produce an executable file with default name the same as your CPP file but without the .cpp extension.

You should then be able to run it within Geany's shell using Execute from the Geany Build menu, or shortcut F5

  • it works but the result file didn't run when i click it so what should i do????? – khaled Sep 1 '15 at 15:02
  • it just run with geany but not when i try to open it from home folder – khaled Sep 1 '15 at 15:16
  • @khaled IMHO that's a different question - it concerns the behavior of your file manager rather than being anything to do with Geany – steeldriver Sep 1 '15 at 15:31
  • so how can i fix this behavior so that i can run it without opening Geany – khaled Sep 1 '15 at 15:37
  • @khaled You could chmod +x filename and then, from command line, ./filename? This sets the "executable" permission on the file and then runs it. – user323419 Sep 1 '15 at 18:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.