I really didn't think it would be this difficult. Geany clearly has the ability to create projects, add files to the projects, compile the individual files, but then even after googling it I could not find a clear description of how to build and execute the project... It's pretty annoying because I really like the simplicity of Geany and its clean, uncluttered workspace, but this could be a deal breaker.
-
1Wow, if it is so hard to do something as trivial as a build and execute, then there may be something seriously wrong with the IDE. – Alexander Rafferty Dec 17 '10 at 22:41
-
Did you try the project properties? – Ignacio Vazquez-Abrams Dec 17 '10 at 22:41
-
2@Alexander: It's *not* an IDE. It's an editor that can call external commands. – Ignacio Vazquez-Abrams Dec 17 '10 at 22:41
-
3I don't use that feature. Put a terminal nearby and do your build like a man. Hell it even includes an "integrated terminal". (Which I disable also). – Matt Joiner Dec 18 '10 at 00:04
-
9@MattJoiner if "building like a man" means hating efficiency, then I'll continue my non-manly, 1-keystroke compilation techniques. – weberc2 May 30 '12 at 16:13
-
1Does anyone other than me find typing `make` quicker and easier than grabbing the mouse and clicking some icon or menu item? – Crowman Jul 23 '13 at 16:45
-
2@PaulGriffiths Not if you have to make an actual makefile – dukevin Oct 10 '14 at 06:09
6 Answers
Geany doesn't compile projects. You can use a makefile to serve the same purpose; however, you have to make it manually or use an external command that can figure out dependencies. Geany's "make" command will use the make file called "makefile" by default, so you can simply give your make file that name and all should be well.
all: hello
hello: main.o factorial.o hello.o
g++ main.o factorial.o hello.o -o hello
main.o: main.cpp
g++ -c main.cpp
factorial.o: factorial.cpp
g++ -c factorial.cpp
hello.o: hello.cpp
g++ -c hello.cpp
clean:
rm -rf *o hello
Example taken from here. You can find more detailed information on that page as well.

- 7,423
- 4
- 41
- 57
To build project just open a file of the project, then choose Make in the Build menu (shift+F9).
For executing menu Build and Execute (F5).
If the project does not compile using make (as it usually does on Linux), you will also have to edit properties of the project in the menu Project entry Properties.
If you want details you could also read the manual, it could seems dumb compared to googling, but it looks quite clear to me... Just hit F1 key.

- 23,497
- 17
- 97
- 116
-
You described compiling the file, not the project. Geany doesn't include any of the project files in the compile command except the current, which is the main problem. And how could one edit the Project Properties to dynamically include all files from the directory? – weberc2 May 30 '12 at 16:24
-
@webarc2: no, I don't describe compiling a file (Compile command F8 shortcut) but building the project through "make" command. The make command works through a file (Makefile) describing all the targets of a project and compilation options. This may seem strange if you are only used to Visual Studio, but it's NOT the job of the editor to manage project files (and nothing force you to put them all in the same directory). – kriss Dec 07 '15 at 01:12
-
Haha, thanks. In the 3.5 years since I asked that question I've learned the answer on my own. :p – weberc2 Dec 07 '15 at 01:15
-
Good.When I stumble on an old broken comments chain, I can't help but fix it. It may help others. – kriss Dec 07 '15 at 01:20
-
-
No harm. I just went there wondering why someone downvoted that old answer. Probably someone who trusted the comment :-) – kriss Dec 07 '15 at 01:32
According to this, hit F8 to compile and F5 to run the project. You first have to setup the compiler though, as mentioned in the article.

- 134,091
- 45
- 190
- 216
-
-
1Here is a copy of the article from archive.org: https://web.archive.org/web/20121125004003/http://grandfiles.com/tutorials/mingw/index.html – ThePirate42 Jul 08 '22 at 15:10
Geany builds projects using external commands. This is flexible and allows the IDE to be language-agnostic, thus being able to build large and heterogeneous projects.
Regarding C++, it's very simple to create a basic Makefile (much simpler than the example above). Supose your project builds a program called "my_program", consists of the files my_program.cpp and bar.cpp, and links with the foo library. All you need is this:
LDLIBS += -lfoo
my_program: my_program.cpp bar.cpp
Save this with the name "Makefile" in the same directory of the sources.Now you have to create the Geany project proper, indicating that the base directory is where the code (and Makefile) are stored.
That's it! you can now compile you program with a keypress (shift+F9). For also running it with a key just enter your program name (my_program in the example) in the Geany's project properties.
Note that it's important that one of your source files has the same name as the target binary, otherwise you cannot user Make's implicit rules, wich complicates the Makefile a bit.
Compiling a multi-file C++ project using Geany's F-keys requires that you first setup a Makefile and the corresponding settings in Geany (as described in previous answers); after such setup is completed the F-keys in Geany's Build drop-down menu become useful for that particular multi-file project.
If however you just want to quickly compile a multi-file C++ project without having to setup a Makefile as well as Geany's settings, use the terminal at the bottom of Geany to type the command-line instruction for compiling a multi-file project:
uberstudent@uberstudent:~$ g++ my_source1.cpp my_source2.cpp -o my_executable
You can then execute your executable with:
uberstudent@uberstudent:~$ ./my_executable
(Note that the above applies to Geany on Linux; I have not tested the above commands on other operating systems.)

- 11
- 1
Assuming you set up your paths(right-click my computer > properties > advanced system settings > environment variables
, just google search what to do next) and Mingw correctly, click on "set build menu commands" and enter the following. including the "".
compile = g++ -O0 -g3 -Wall -c -o"%e.o" "%f"
Build = g++ -o"%e" ./%e.o
Execute = "./%e"
this is what worked for me, if you get an error when trying to build (after you compiled) that says something about some permissions issue, that is b/c of windows UAC is blocking Geany from building. You just need to run geany as admin to resolve this.