VS C++ to XCode

Discussion in 'Mac Programming' started by blufrog, Aug 10, 2016.

  1. blufrog macrumors member

    Joined:
    Dec 19, 2014
    #1
    Hi,

    I seem to be suffering a major mental block regarding getting started programming on OS X.

    I'm a Windows C++/.NET/MASM programmer looking to start developing for OS X, but having a total brain freeze on where to start!

    It seems several methods exist for GUI programming, as well as choice of languages???

    I'm aware of Objective-C (name only, pretty much), but never used it, but it seems Swift is the "new kid on the block", as well as Cocoa, Carbon, and Mach-O. Rather confusing (to me anyway).

    Where should I start? I will be mostly creating simple GUI applications, but also console, and later device drivers/kernel level software for a specific project.

    Does anyone here program in assembler on OS X? Does anyone have any info for that?

    Thanks!
     
  2. hokan macrumors member

    Joined:
    Mar 18, 2014
    Location:
    Sweden
    #2
    Xcode is the official IDE which supports C, C++, Objective-C and Swift as well as some odd stuff like Objective-C++ for integrating Objective-C with C++.

    Objective-C and Swift are both plain programming languages like C++ or C#. Swift is pretty much intended as the replacement of Objective-C although it is still a bit rough around the edges. There are some language syntax changes between the current Swift 2.3 and the soon to be released 3.0 and it will take until Swift 4.0 (presumably another year) for the ABI to become stable. Also note that Swift only supports macOS 10.9 and newer i.e. OS versions no older than 2 years.

    Objective-C can call C and C++ code, I think that Swift can do the same although I haven't looked into it.

    Cocoa and Cocoa touch (for iOS) is usually used to refer to the OS libraries especially the native ones used for Graphics (drawing windows, buttons, …).

    Carbon is mostly a legacy support library used to port apps developed on classical MacOS (version 1-9). Large chunks of Carbon are effectively unusable as they never got 64 bit support and can't handle Retina (HiDPI) display drawing.

    Mach-O short for Mach object file format, is a file format for executables, object code, shared libraries, dynamically-loaded code, and core dumps. A replacement for the a.out format, Mach-O offers more extensibility and faster access to information in the symbol table.
    - wikipedia (https://en.wikipedia.org/wiki/Mach-O)

    Look into .kext files (kernel extensions) for drivers.You can probably find some guides at https://developer.apple.com/library/mac/navigation/#section=Resource Types&topic=Guides . Apple generally discourages the creation of kexts when not absolutely necessary, probably because they pose a security/stability risk and can't be included in apps sold via the App Store.

    You can certainly do assembly on macOS but it's not very common to my knowledge. It can also be counter productive as Apple has multiple CPU architectures between macs, iphones and applewatches. Apple has also occasionally switched CPU architectures there is e.g. the mac: 68K -> PPC -> intel transition. I think the transition form 32 -> 64 bit ARM on iOS was similar.
     
  3. Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #3
    Swift cannot import C++ code.

    Depending on what your project is, you may not need to create a kernel extension.
     
  4. firewood, Aug 15, 2016
    Last edited: Aug 15, 2016

    firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #4
    Kernel and device driver stuff likely requires coding in the C subset of Objective C. Cocoa GUI and command-line stuff can both be done in Swift. Lots of examples and tutorials are becoming available. It's easy to include and call C code from Swift (using an Objective C bridging header). All of the above can be developed using Apple's Xcode IDE and command-line toolchain.

    It should not be too huge a jump from a competent level of C++ and C# to coding in ANSI C and Swift.

    Xcode includes an assembler for building projects that include .s (assembly language) files.
     
  5. iamnotme macrumors regular

    iamnotme

    Joined:
    Jan 24, 2015
    Location:
    SW Ontario, Canada
    #5
    I am one of those lucky ones who has to use Java, Xcode and VS. Java is just Java regardless of the GUI and I love it for it's simplicity. BUT, after 2 years of using Xcode, it still makes me want to pick up my laptop, throw it on the floor then jump on it repeatedly. I still can't get used to the layout and GUI editing in it is an acquired taste. I think I find it difficult because before starting on OS X and Xcode, I used VS.NET for about 10 years or more. VS is simple as hell as far as designing GUIs and adding code goes.
     
  6. jweinraub macrumors 6502

    jweinraub

    Joined:
    Jun 26, 2007
    Location:
    Sol III
    #6
    I too been using Visual Studio in some form since Visual Basic, MFC, Visual C++, C#, ... &c and I have to admit Xcode (and KDevelop for that matter since they are similar in the sense) develop GUIs, weird. I am very used to the idea of drawing on the screen, then making events or double clicking a button rather than actually physically drawing a signal to a receiver and seemingly add more code than necessary.

    For all of its flaws, it is really the one thing I love about Visual Studio and would pay a lot of money to have it in MacOS so I can get rid of XCcode. It also helps I like C# and C++ much better than Objective C and don't get me started on Swift, I am just not a fan. Maybe I am a purist, but I like my semicolons!
     
  7. iamnotme macrumors regular

    iamnotme

    Joined:
    Jan 24, 2015
    Location:
    SW Ontario, Canada
    #7
    It sounds like we
    It sounds like we are in pretty much the same position although I actually quite like swift as a language, but that doesn't change the GUI design. However I really think that compared to .NET stuff in Windows, Xcode creates very lightweight runtime. As far as ease of use goes, yes I'd say VS is easier for me as well but that's also because I really learned to program in it starting with VB6. I haven't seen Kdevelop but I'll look at it now.
     
  8. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #8
    Hmm strange, VS is imho one of the worst IDEs on the market. Right behind Eclipse. Xcode on the other hand is very nice to use.

    What do you like at VS that is different/missing at Xcode?
     
  9. Floris macrumors 68020

    Floris

    Joined:
    Sep 7, 2007
    Location:
    Netherlands
  10. firewood, Aug 27, 2016
    Last edited: Aug 27, 2016

    firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    They both require lots of setup and have lots of distracting and unnecessary eye-candy. Programmers used to develop big applications using vi/eclipse on an 80*24 CRT, and sent astronauts to the moon using punch cards for NASA's software.

    Woz created the first Apple I and Apple II programs by remembering 6502 op-codes and entering them in hex. Gates and Allen used a teletype. They created billion dollar companies starting with their code. What have you done using your fancy IDEs?

    The basics of programming, knowing how to create useful software to solve problems, has very little to do with fancy IDE features.
     
  11. JazzJohannes macrumors newbie

    Joined:
    Nov 18, 2008
    #11
    firewood,

    You should use VMware Fusion with VS then, and not bash XCode. I know C# up to this date seems fancier in code, but that's all it is, it's not better than Swift, it just invented fancy words for unnecessary functionality making code more cryptic rather than descriptive. And to be frank, who needs programming languages anyways, in some not so distant future, five year olds will all be making powerful apps using graphical editors anyways, just like in web development. Noone needs coders anymore.
     
  12. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #12
    I used to hate Swift, until I started using C#. C# made me appreciate Swift a LOT more.

    Things I would do in C# seemed unnecessary and redundant and it made me realize why concepts in Swift that I originally found foreign (Optionals for example) were useful.
     
  13. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #13
    If you know MFC, C++ then the switch to objective C and the Apple API is not too difficult.

    I've used VS and believe Xcode is a much better and easier programming suite, but it only does two primary languages while VS allows a bit more.

    Since you are experienced grab a free copy of Xcode and start a project in either swift or objective c. The issues will rise quickly and then you will seek and find answers.
     
  14. DaveP macrumors 6502

    DaveP

    Joined:
    Mar 18, 2005
    #14
    Your last statement is absolutely true and should be emphasized. The rest though just comes across as the irrelevant rantings of an angry, old man.

    Napoleon conquered much of Europe and created an empire on horseback. What have you done using your fancy cars?
     
  15. MichaelDT macrumors member

    Joined:
    Aug 18, 2012
    #15
    Kernel extensions are written in C++ never straight C as per XNU specs you will take the whole system down if you try anything else I.e. KP. It's also known as IOKit
     
  16. bjet767 macrumors 6502a

    Joined:
    Oct 2, 2010
    #16
    In the day I wrote code with a punch card machine after planning it out on paper. When pcs came along I used a text editor and then compiled with what we today call terminal line commands.

    Boy do I like the fancy suites and real time testing capabilities of today's integrated programming environments like Xcode.

    It wasn't too long ago that one had to manually figure out constraints for the iOS user interface objects and now we have 'storyboards.' What will they think of next?

    Love the new stuff and remember the day.
     

Share This Page