PDA

View Full Version : Objective-C/Cocoa cross platform compatibility.




Dragonlance1561
Feb 5, 2009, 05:55 PM
I have been looking around on the web and I have seen mixed answers about Objective-C and Cocoa being compatible with windows and linux and other OS's. I'm thinking that Objective-C is while Cocoa is not. Am I correct?



ray648
Feb 5, 2009, 06:24 PM
Yes, you are correct. Objective C can be compiled on any platform with a suitable compiler, including windows and linux, but Cocoa is apple specific.

Cromulent
Feb 5, 2009, 06:33 PM
Depends. As far as I know Objective-C 2 is Apple only still.

ChrisA
Feb 5, 2009, 06:49 PM
..Objective-C and Cocoa being compatible with windows and linux and other OS's. I'm thinking that Objective-C is while Cocoa is not.

You are correct.

Apple uses the Open Source gcc compiler as part of x-code. gcc runs on every computer and OS known to man (almost) and gcc does Objective-C (and C, C++, FORTRAN, Ada and Java as well). So the language itself is portable to every place that gcc runs.

Cocoa however is Mac-only.

OK

Dragonlance1561
Feb 5, 2009, 10:06 PM
ok thanks, I'm learning C++ now, how transferable is knowledge of C++ to Objective-C? From what I have read it's quite transferable.

Also, can anyone point me to any websites or books that will teach me to make GUI's on other OS's (mostly windows) in Objective-C and/or C++?

I want to be able to write my source code on my mac so I can't use MS Visual C++ for windows. Linux isn't a big issue, mainly windows i want to run my programs on, and I know i can just use interface builder on mac. (but learning the hard way is always a bonus)

EDIT!: Even better would be books or websites about making cross-platform GUI's if possible.

sanPietro98
Feb 5, 2009, 10:48 PM
Has anyone here tried using Cocotron? They claim to make a subset of cocoa multiplatform. I'd be interested to hear any experiences.

Cromulent
Feb 6, 2009, 01:18 AM
ok thanks, I'm learning C++ now, how transferable is knowledge of C++ to Objective-C? From what I have read it's quite transferable.

Also, can anyone point me to any websites or books that will teach me to make GUI's on other OS's (mostly windows) in Objective-C and/or C++?

I want to be able to write my source code on my mac so I can't use MS Visual C++ for windows. Linux isn't a big issue, mainly windows i want to run my programs on, and I know i can just use interface builder on mac. (but learning the hard way is always a bonus)

EDIT!: Even better would be books or websites about making cross-platform GUI's if possible.

Windows uses Win32 or the .Net platform to do its GUI programming. Mac OS X uses Carbon or Cocoa. No matter what you do you will need to write separate code for the GUIs for each platform.

A better solution would be to use the Qt framework which is written in C++ and works on Windows, Mac OS X and Linux and would allow you to do all your GUI programming for all platforms on the Mac and would just require a recompile on the other platforms (assuming of course the rest of your code is platform agnostic).

Edit : Of course this means you won't be able to use Interface Builder at all but would need to use Qt Designer to build your GUIs. See http://www.trolltech.com/qt for more information.

Oh and as long as the applications you write are open source it is free. If you want to write commercial software you need to pay a license fee.

Dragonlance1561
Feb 6, 2009, 03:40 AM
Edit : Of course this means you won't be able to use Interface Builder at all but would need to use Qt Designer to build your GUIs. See http://www.trolltech.com/qt for more information.

That sounds great to me. I would rather just learn C++ for now anyways.

Oh and as long as the applications you write are open source it is free. If you want to write commercial software you need to pay a license fee.
I am doing this for personal use and school work, no commercial use intended.

P.S.

(assuming of course the rest of your code is platform agnostic).

What does agnostic mean I never seen that word before.:o

Cromulent
Feb 7, 2009, 09:38 PM
What does agnostic mean I never seen that word before.:o

Well when used in the religious sense it means undecided basically. So when used in the programming sense it basically means cross platform compatible as you have not decided on which platform to use. Does that make sense?