1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Quick questions regarding C++

Discussion in 'C, C++, C#' started by manno, Jul 28, 2011.

  1. manno

    manno Registered Member

    Joined:
    Apr 26, 2010
    Messages:
    79
    Likes Received:
    35
    Occupation:
    Black Hat SEO
    Location:
    The Internet
    Home Page:
    If I code a program in C++ in Xcode on a Mac, can the code be compiled in Windows without changing a single line?

    Also, is it possible to build a GUI for Windows, and build a GUI for Mac from the same C++ base program?

    Is it possible to build a GUI for Mac for a C++ program at all??
     
  2. sirgold

    sirgold Supreme Member

    Joined:
    Jun 25, 2010
    Messages:
    1,260
    Likes Received:
    645
    Occupation:
    Busy proving the Pareto principle right
    Location:
    A hot one
    Yes, it's possible. You need to use a cross platform framework like QT that's a solid alternative in order to port the same code to windows, mac, linux and mobile platforms without changing a line of code and without sacrificing (well, too much..) the sheer speed of a native UI c++ app. No .net / bytecode crap.

    There are other toolkits that are multi-platform like wxwindows but QT is commercially backed (Nokia owned) while being free and in my opinion the most mature of them all. Plus it's written in c++ for c++ as requested, there's plenty of docs and code around and the development environment it comes with (for win, mac and linux) is really top notch.

    HTH
     
  3. manno

    manno Registered Member

    Joined:
    Apr 26, 2010
    Messages:
    79
    Likes Received:
    35
    Occupation:
    Black Hat SEO
    Location:
    The Internet
    Home Page:
    Thanks, that's what I was looking into but wasn't sure it was any good.

    We'll see how it goes with Qt.
     
  4. Xooor

    Xooor Newbie

    Joined:
    Aug 14, 2011
    Messages:
    18
    Likes Received:
    17
    Hello there,

    I've been programming in C for several years now and C++ for a good two. So I have pretty good experiences with both.
    I've also worked with GTK+ and Qt in the past for my own personal usage and applications for some clients.

    To sum it up, if you want to do cross-platform GUI programming in C++, you have a few options :

    - WXwidgets (C++)
    - GTKmm (a C++ wrapper of GTK+ and uses glibmm)
    - Qt (C++)
    ...

    Those are the main ones, there are a few others though.

    But out of all the libs I would recommend Qt, it's a very good framework :
    - Good GUI library
    - Also has networking libraries, multimedia libraries
    - So it's actually a very complete framework and can be used to do much more than simple GUI programming which isn't really the case of WXwidgets or GTKmm.

    So I think Qt is really a no brainer. It's brilliantly cross platform so it works with about no code changes on Windows, Mac OS X and most Unixes with X11 (Linux, BSD ...). And to make it even better, Qt comes bundled with a great bunch of tools.

    - QtDesigner (GUI design)
    - And better QtCreator(an IDE with GUI design integrated, very easy to use)

    Hoping that this information is useful.

    Yours sincerely, Xooor.
     
    • Thanks Thanks x 1