I am a big fan of Geany IDE and Ubuntu. I am learning Objective-C programming language. I have Objective-C Environment in Ubuntu 16.04 and I compile Objective-C programs using terminal. But I want to make a build command in Geany for that purpose. But Geany recognises Objective-C programs which have .m file extension as Matlab/Octave commands. So suggest me a method to compile & execute Objective-C programs directly from Geany by making a build command in Geany.
Asked
Active
Viewed 3,664 times
1 Answers
2
Geany should already have a build configuration for Objective-C, provided by the filetypes.objectivec file (part of the geany-common package):
[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=gcc -Wall -c "%f"
linker=gcc -Wall -o "%e" "%f" -lobjc
run_cmd="./%e"
The tricky part is making geany actually choose that, instead of the one for Matlab (since both filetypes are associated with the .m extension in the filetype_extensions.conf file). Currently, the only way I know to do that is to manually select the filetype from the Document menu
Document --> Set Filetype --> Programming Languages --> Objective-C
After that, you should be able to build your file from the Build menu as normal.
steeldriver
- 131,985
- 21
- 239
- 326
-
Thanks a lot for your help!! But I am still getting a problem. I am able to run my file easily after following the above steps. But when I compile my file, I get this message: gcc -Wall -c "HelloWorld.m" (in directory: /home/gkv/Desktop/objectiveC) HelloWorld.m:1:33: fatal error: Foundation/Foundation.h: No such file or directory compilation terminated. Compilation failed. (HelloWorld.m is the name of the Objective-C file I made) – Gautam Vashisht Jun 12 '16 at 14:57
-
I am able to execute Objective - C programs correctly but I get error during compiling which I have stated in the above comment. Please help me get rid of this compiling error. – Gautam Vashisht Sep 24 '16 at 09:19
-
@GautamVashisht I don't know anything about Objective-C, but my guess is you either don't have the [Foundation Kit](https://en.wikipedia.org/wiki/Foundation_Kit) in your environment (or need to specify its include path, if you do). – steeldriver Sep 24 '16 at 11:32
-
I have Foundation Kit in my environment due to GNUStep. I think it is not accesible outside the GNUStep's workspace or IDE as I am using Geany. I will find its solution later on. But thanks a lot for your help. You have really helped me improve my workflow. – Gautam Vashisht Sep 25 '16 at 08:01
-
It may be as simple as adding the GNUStep include path to your build options e.g. `-I /usr/include/GNUstep` - anyway good luck – steeldriver Sep 25 '16 at 11:48
-
Yes, I did the same thing and it worked. Now I am not getting any compiling errors. Thanks a lot ! – Gautam Vashisht Sep 26 '16 at 11:08