Setting Up Objective-C with Kdevelop - objective-c

Does anyone know how to setup Objective-C with KDevelop? I've been searching and searching for a supposed "patch", which is supposed to integrate support in with the IDE, yet I haven't been able to find it.

This has been partially treated on StackOverflow already. Apart from the discussion over there, I sometimes use Emacs besides Xcode. I use Emacs for most of my editing and coding needs, and it comes with a nice Objective-C mode. Autocompletion in Xcode is the big selling point, but I just found out there is an answer on Stackoverflow as well. I haven't tried it yet, but it might be worth checking out.

I would go to GnuStep.org, and ask this question on their mailing list. They're the guys who do the most obj-c development on Linux that I know of.

I'm also interesting in developing on Linux using Objective-C. Due to the success of the language on Apple platforms, there are an increasing number of skilled Objective-C Developers whose efforts could benefit OSS if only the gap in Linux tooling were closed.
GNUstep is a fantastic effort and, along with LLVM and Clang, goes much of the way to achieving this. But: there is no modern IDE which supports Objective-C in Linux. ProjectCenter is the official GNUstep IDE but honestly it is showing its age.
JetBrains seem to be in the best position to change this situation: they are producers of the foremost Objective-C IDE for iOS: AppCode, and have just released a C/C++ IDE for Linux called CLion. If enough interest is shown, perhaps they would consider integrating Objective-C support from AppCode into CLion. Compiling against GNUstep, this would breathe new life into cross-platform Objective-C development.
I would encourage anyone interested in this possibility, to sign into JetBrains request tracker and vote for this issue: https://youtrack.jetbrains.com/issue/CPP-3353

Related

Compiling Objective-C app for Linux (API coverage)

I might be asking something strange here, but I'm unsure where to begin. The thing is that I am considering writing a command line tool on a Mac using Obj-C and the Foundation classes.
But there is a very big risk that I would like to be able to compile it for different Linux distributions to run as a server app in the future.
I understand that it is not a problem in itself to compile Objective-C for Linux, but what I don't understand is the API coverage.
As I have understood it so far I can use GNUStep to compile for linux, but is there a good way for me to get an overview of the API coverage? What I mean is, if I use a class that has been added to the Foundation framework in OSX Lion lets say, how big is the risk of that not being available in GNUStep at that time?
I hope I am asking a question that you guys can understand, basically I want to avoid writing an app that can theoretically be compiled for linux, but not in practice because of missing classes etc.
Thanks!
An opinion: The risk is fairly high. GNU Step is an open source project and dependant on its volunteers to keep it up to date. OS X Lion has a small number of additions to Foundation and AppKit.
Your best option if you want it for *nix in the future will be to write it in generic C/C++ and then thinly wrap it in an NSTask if you want a GUI.
You should be able to check if the API's you're using are available by consulting the GNUStep base API docs.
You may want to target GNUStep as your base if compatibillity is a big concern. Compiling for mac should then be rather trivial, compared to moving the code the other way. Of course you always have the option of helping inplement whatever is missing from GNUStep too.

REPL for Objective-C

Is there a REPL for Objective-C?
I am learning Objective-C and am sorely missing a REPL, coming from a Python background.
F-Script provides a Smalltalk-inspired REPL for Cocoa development, and Nu provides a Lisp-based one. F-Script seems a bit more polished and offers an object browser.
They both seem to be targeting OS X, rather than iOS development. There are scattered forum and blog posts with people describing using Nu for developing iOS apps, but they all seem to be from about two years ago. There's also a YouTube video, "Using a Scheme REPL to debug iPhone apps real-time" with a screencast of a fellow using Scheme to debug an iPhone app.
I haven't experimented with any of these technologies, but I would love to hear from anyone who has.
I just realized there's a simpler answer to all this. If you're coming from Python, and want to experiment with Cocoa in a REPL, you should just use the Python REPL. OS X ships with a Python to Objective-C bridge. Just run Python, do import objc, and you're off. There are also bridges for Ruby and Common Lisp, among others.
Of course, all these REPLs only let you write dynamic code to interact with Cocoa, but they don't let you write actual Objective-C code, and interpret it or compile it on the fly to interact with it dynamically. So none truly meets your original requirement.
When a breakpoint is triggered the debugger should pop open. When in the debugger, you can type whatever you want into gdb. You can use p [someObj someMethod] to print things out that are in scope to your breakpoint. gdb is a powerful utility well documented all over the web.
That's going to be as close as you get to what I think you are after. This is just a much clunkier thing to do in compiled languages, as there isn't any eval in Objective-C.
As far as I know, the closest you can get to a REPL at the moment is indeed through debuggers (i.e. GDB or the LLVM debugger LLDB).
For pure C, there is CCons.
Most things in Apple's Objective-C APIs (particularly Foundation) also have direct C equivalents (e.g. CFRelease(obj); is the same as [obj release];), which you can use in CCons.
CCons is built on top of LLVM and Clang, which also support Objective-C. It is probably possible to extend CCons for to also support Objective-C.
The 'trial' of CoderPad gives a public facing self-only REPL for zillions of languages including objc!!! I just used it and it's really a good sales tool for them (I'm not affiliated; they make tools for people interviewing coders). https://coderpad.io/
In the Gambit Objective-C project there seems to be an attempt to create a Scheme based REPL.
The REPL in Ruby Motion is also supposed to be good for exploratory purposes (I haven't tried it myself, though).
Yes, the REPL is in the output window.
"print object"
po object
but also execute commands which are running as app code with
expression i = 5
Read this interesting full debugging article for more information.

Can we compile objective c on windows?

Can we compile objective c on windows platform?
Quick answer: no, not to any useful degree.
Long answer: Objective-C is just a standard language, and GCC compiles it just fine. But when most people talk about Objective-C, they are including Apple's (formerly NEXTstep) libraries, as the bare language isn't too useful without them. There are projects around to let you use these libraries on non-Mac systems, for example GNUstep, but from my experience they are immature and more trouble than they are worth. I haven't looked recently, but I wouldn't spend too much effort trying to get it to work.
If your framework needs are basic, you can try cocotron, but I understand it is not yet "there" in many areas. http://www.cocotron.org/

Is it possible to execute Objective-C programs in Windows?

I googled a lot. Some people are saying do this. Some are saying it's not possible. Install Mac OS X on a virtual machine, etc., etc.
I have a simple question.
Is it possible that I can practice Objective-C programming on a Windows 7 machine?
If yes, how? Please, if possible, provide me with a necessary link. My ultimate goal is to go for iPhone development. But right now I can't afford a MacBook.
So is it possible?
Objective-C, the language, definitely yes. At the very least, GCC (GNU Compiler Collection) compiles Objective-C just fine. You can get either Cygwin for the full POSIX-like environment, or MinGW which gives just the GNU toolchain for programming to the Win23 API
But, iPhone needs the Apple API, which is totally proprietary; if they say 'No Windows', then it's just not available for Windows
Of course the iPhone API is based on Cocoa, which is based on NextSTEP. You can get the feel of the API with OpenSTEP.
But it's not iPhone.
Yes you can compile Objective-C on Windows. But for iPhone development this question was already asked.
And there are several similar questions about iPhone development here on Stackoverflow, just search for it.
It's worth taking a look at Cocotron— that aims to implement a cross-platform Apple-compatible version of the core NeXTStep libraries, the FoundationKit and ApplicationKit. Windows included.
GCC (http://gcc.gnu.org/) can compile Objective-C.
The answer is yes, but it will probably require quite a lot of work on your part:
www.gnustep.org
www.cocotron.org
This page on StackOverflow, answer 4. It worked great in my case.
Objective C for Windows

Other than Xcode, are there any full functioned IDEs for Objective-C? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with:
code completion
compilation
debugging
refactoring
Extra points for being cross platform, supporting vi key bindings and supporting other languages.
Note:
I've updated and accepted my answer below as Jetbrains has released Early Access for AppCode, their new Objective-C IDE. Since this has been a fairly popular question, I thought it worthwhile to update the information.
I recently learned that Jetbrains the make of my favorite IDE (Idea) may support Objective-C (though it is unclear how much it will work for iPhone/iPad development). See the thread here for early discussion on this.
In the last year or two, they have started adding additional language support both in their flagship IDE as well as specialized IDEs (for Ruby, Python, PHP). I guess this is just another step in the process. I for one would love to have another option other than XCode and I couldn't think of one that I'd love more.
This is obviously vaporware at the moment, but I think it is something to keep an eye on.
This is now a real product, albeit still in Early Access. See here for a the blog on this new product, which will give you pointers to check out the EAP.
UPDATE: AppCode has now been released and offers a true alternative to using Xcode for Objective-C and iPhone/iPad/Mac development. It does still rely on Interface Builder for layout and wiring of GUI components and uses the iOS simulator, but all coding, including a slew of refactorings, smart templating and static analysis, is available through App Code.
Textmate is an editor like BBEdit but it has the ability to run commands such as compilation, debugging, refactoring (though it will do so via XCode). It also has code completion.
In addition, you can write your own commands for Textmate that you can then run.
I have been searching for something like this that does NOT run on mac for quite a few months now. Unfortunately I think that due to the relative obscurity of the Objective-C language that nobody has ever bothered producing such a full featured IDE for it. Until now, and we only have Xcode.
Using JBuilder I fell in love with the auto-completion and displaying the function 'hints' on the screen while I type. I am that sort of person who remembers the 'ideas' better than the actual syntax and really benefits from knowing right then and there that the code I typed was correct, not having to find out a minute later at compile time. And then to have to try and figure out if I just misspelled something, or if I truly made a conceptual error due to a misunderstanding of proper use of the language. Code completion and hints have always saved time on this for me.
I know some people may look down on this and say the feature is unnecessary if you know what you're doing, but I never claimed to be better than anyone else.
I may have to just give up and try and get OS X running on my PC. Which doesnt bother me in the least, just the rebooting to go back and forth to windows. I've tried to run it virtualized under VMWare but XCode kept crashing :( That reminds me I am going to google 'leopard vmware' and see if any progress has been made in that area.
Another problem in designing a full code-completion system with objective C is that the syntax is a little more forgiving, I dont know the exact technical term (strongly typed?) it is much harder to say exactly what sort of object belongs in a certain parameter and ANY object can be sent ANY message whether it implements that function or not. So you can spell a function name wrong, but it doesnt necessarily mean you made a syntax error... maybe you mean to call a function of that OTHER name and you just want nothing to be done if the function is not implemented by your object.
That's what I would really like to see for Objective-C, is an IDE that once it notices you are sending a message to an object, it displays a list of methods and function definitions that the object is known to accept, and walks you through filling in the parameters.
I think you would waste less time by sticking with Xcode rather than looking for another IDE if you want to develop for the Mac (or iPhone).
Apple made a lot of effort to kill any competitor in that area to make sure any developer wanting to develop for the Mac platform use Xcode and only Xcode.
It might not be the best IDE but it does work well and it is the IDE developers at Apple are using. Somehow it does its job. The frameworks and the documentation are very well integrated.
I use TextMate a lot and also SubEthaEdit but they are not full IDE as you’ve described above.
Best Regards.
Check out JetBrains' new IDE called "App Code". It's still in the Early Access Program, but even with the Early Access bugs it is hands-down better than xcode 4. I've been using it for commercial iPhone and iPad development.
http://www.jetbrains.com/objc/
I would like to second Troy's answer and note that JetBrains has AppCode in early access, so you can try it for free. It has the familiar UI of their other products, and yes, it supports vi! So far it has been very good. I have run into a few issues, and a few vi-isms that don't work quite right, but it is still better than suffering with Xcode. I do text editing with syntax completion in AppCode, but switch back to XCode to get into the GUI builder which is actually quite good in Xcode.
If you are an old vi-guy like myself, it is invaluable.
The short answer is: No. There are thousands of IDEs but Xcode is the only one which you seriously can name IDE. I suggest you have a look at the tries of GNUStep (in form of Projectcenter, Gorm) and then you can imagine the state of affairs.
I believe KDevelop is the only full IDE that supports Obj-C, but I'm not even sure how fully it supports it, having never used it myself. Worth a shot, maybe.
There are a few programmers text editors that support Objective-C, but I like Editra, mainly because I also write Python on Windows\Nix and it has great features. Editra runs well on all platforms and has a nice plug-in that supports Mercurial, GIT, and Subversion if you need them. Another nice thing, its written in Python. Editra Home
Found another, though it sounds less than ideal:
ActiveDeveloper - doesn't appear to have active support (last update was in 2006). Mac only.
KDevelop sounds like it only supports Objective-C syntax and only through its C support. I'm going to check it out anyway.
Textmate has a couple screencasts for Objective-C (here and here). It is Mac only, but otherwise looks pretty good. It is hard to tell from the screencast how strong the integrated support is as it seems to just have a lot of scripts to handle the code. Also, I can't tell if it does true code completion or just expansion for snippets.
So it doesn't look like there is anything out there that hits everything. I'll probably do most of my development on Mac, so I'm thinking I'll try out TextMate with XCode to see if it is any better than straight XCode. I'll take a quick look at KDevelop.
Thanks.