C++0x -- IDE/Compiler

Discussion in 'Mac Programming' started by er2020, Aug 14, 2010.

  1. er2020 macrumors newbie

    Joined:
    Aug 14, 2010
    #1
    Hello,

    I need to develop cross platform and test some C++0x. It is supported under GCC4.4 but unfortunately XCode stops at GCC 4.2. Besides working under a different OS, could someone suggest to program in C++0x under OSX? Freeware only.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Is C++0x even a finished standard yet? Anyways you could try using LLVM CLang within XCode. It's not perfect though. Or use fink to install GCC 4.4
     
  3. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #3
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    The link I posted has the C++0x compatibility status. It depends which C++0x features you need...
     
  5. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #5
    The features I need are variadic template and rvalue references, but apparently only the latter is supported by LLVM.

    Anyways, I installed fink and did
    $fink install gcc44

    Would by some miracle XCode allow switching to this compiler? I guess not, and in this case, is there an IDE for using GCC4.4?
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    I've not tried this but I think you can double click on the target, switch to the Build tab, scroll down to "Compiler Version", choose Other in the drop down and provide the path to the compiler you want to use. If that doesn't work then read the XCode documentation as it will tell you how to switch compilers.
     
  7. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #7
    Thanks, but I had tried that already.

    How can I even check that GCC4.4. is installed? I did a search in finder on variations of gcc-4.4 which only returned *.info files.
     
  8. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #8
    Fink installs stuff in /opt. Look for /opt/bin or something similar, it'll be in there somewhere.
     
  9. ShortCutMan macrumors member

    Joined:
    Aug 8, 2005
    #9
    Latest versions of GCC support 0x features through a command line switch. I don't know about the LLVM GCC frontend, but clang's C++ support has not reached production quality yet so it probably isn't the best compiler to work with new 0x features.
     
  10. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #10
    "Latest versions of GCC support 0x features through a command line switch. "

    You mean -std=gcc0x? Sure, but first I need to be able to use the GCC4.4 compiler : the one that I installed via Fink! And I already ruled out LLVM.
     
  11. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #11
    The fink page for gcc 4.4 notes that the compiler will be called gcc-4. What did you search for when you didn't find it?
     
  12. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #12
    Thanks, but my /opt only has a directory /local and it doesn't seem to have anything in it that Fink would have installed. I'd have thought it would be in
    /sw/bin or something but no. Here's the log (abridged) in case someone has an opinion. I assumed the problems towards the end were incidentals, but maybe not, which leads me to the same question : how do I check that Gcc4.4. is properly installed?

    $ sudo fink install gcc44 gcc44-shlibs
    Password:
    Scanning package description files..........
    Information about 3643 packages read in 1 seconds.
    The following 2 packages will be installed or updated:
    gcc44 gcc44-shlibs
    The following 19 additional packages will be installed:
    autoconf cloog cloog-shlibs expat1 expat1-shlibs gettext-tools gmp gmp-shlibs libgettext8-dev
    libgmpxx-shlibs libmpfr1 libmpfr1-shlibs libtool14 libtool14-shlibs m4 ppl ppl-shlibs texi2html
    texinfo
    Do you want to continue? [Y/n]

    ...

    Creating shlibs files...
    dpkg-deb -b root-gettext-tools-0.17-17 /sw/fink/10.6/stable/main/binary-darwin-i386/base
    dpkg-deb: building package `gettext-tools' in `/sw/fink/10.6/stable/main/binary-darwin-i386/base/gettext-tools_0.17-17_darwin-i386.deb'.
    Writing control file...
    dpkg-deb -b root-libgettextpo2-dev-0.17-17 /sw/fink/10.6/stable/main/binary-darwin-i386/base
    dpkg-deb: building package `libgettextpo2-dev' in `/sw/fink/10.6/stable/main/binary-darwin-i386/base/libgettextpo2-dev_0.17-17_darwin-i386.deb'.
    Writing control file...
    Creating shlibs files...
    dpkg-deb -b root-libgettextpo2-shlibs-0.17-17 /sw/fink/10.6/stable/main/binary-darwin-i386/base
    dpkg-deb: building package `libgettextpo2-shlibs' in `/sw/fink/10.6/stable/main/binary-darwin-i386/base/libgettextpo2-shlibs_0.17-17_darwin-i386.deb'.
    Removing runtime build-lock...
    Removing build-lock package...
    /sw/bin/dpkg-lockwait -r fink-buildlock-gettext-tools-0.17-17
    (Reading database ... 5625 files and directories currently installed.)
    Removing fink-buildlock-gettext-tools-0.17-17 ...
    Reading buildlock packages...
    /sw/bin/dpkg-lockwait -i /sw/fink/dists/stable/main/binary-darwin-i386/base/gettext-tools_0.17-17_darwin-i386.deb
    Selecting previously deselected package gettext-tools.
    (Reading database ... 5624 files and directories currently installed.)
    Unpacking gettext-tools (from .../gettext-tools_0.17-17_darwin-i386.deb) ...
    Setting up gettext-tools (0.17-17) ...
    * gettext: (gettext). GNU gettext utilities.
    install-info(/sw/share/info/gettext.info): creating new section `GNU Gettext Utilities'

    Reading buildlock packages...
    Could not resolve inconsistent dependencies!

    Fink isn't sure how to install the above packages safely. You may be able to fix things by running:

    fink scanpackages
    sudo apt-get update
    sudo apt-get install libgettext3-dev=0.14.5-2

    Updating the list of locally available binary packages.
    Scanning dists/stable/main/binary-darwin-i386
    New package: dists/stable/main/binary-darwin-i386/base/expat1-shlibs_2.0.1-1_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/base/expat1_2.0.1-1_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/base/gettext-tools_0.17-17_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/base/libgettextpo2-dev_0.17-17_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/base/libgettextpo2-shlibs_0.17-17_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/devel/libtool14-shlibs_1.5.26-3_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/devel/libtool14_1.5.26-3_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/devel/ppl-shlibs_0.10.2-2_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/devel/ppl_0.10.2-2_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/libs/gmp-shlibs_4.3.1-1000_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/libs/gmp_4.3.1-1000_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/libs/libgmpxx-shlibs_4.3.1-1000_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/libs/libmpfr1-shlibs_2.4.1-1_darwin-i386.deb
    New package: dists/stable/main/binary-darwin-i386/libs/libmpfr1_2.4.1-1_darwin-i386.deb
    Failed: Fink::SysState: Could not resolve inconsistent dependencies

    Thanks. I searched for gcc-4 but it only returns gcc-4.0, 4.1 etc. all but 4.4.

    Anyways, at this stalled stage, I should perhaps

    - remove gcc44-shlibs which was stupid of me to install as I did not need it that much (I guess), and
    - attempt a clean rebuild of GCC44.

    What are the commands for each, please?

    So much for shlibs:

    $sudo fink remove -r gcc44-shlibs
    Password:
    Information about 3643 packages read in 1 seconds.
    WARNING: gcc44-shlibs is not installed, skipping.
    Nothing remove --recursived

    However,

    $fink -l rebuild gcc44-compiler
    Information about 3643 packages read in 0 seconds.
    Failed: no package found for specification 'gcc44-compiler'!
    erwann-macbook:~ erwann$ fink -l rebuild gcc44
    Information about 3643 packages read in 1 seconds.
    The following package will be rebuilt:
    gcc44
    The following 7 additional packages will be installed:
    autoconf cloog cloog-shlibs libgettext3-dev m4 texi2html texinfo
    Do you want to continue? [Y/n]
    curl --connect-timeout 30 -f -L -A 'fink/0.29.10' -O http://distfiles.master.finkmirrors.net/gcc-4.4.1.tar.bz2
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 59.9M 100 59.9M 0 0 284k 0 0:03:36 0:03:36 --:--:-- 287k
    Reading buildlock packages...
    Could not resolve inconsistent dependencies!

    Fink isn't sure how to install the above packages safely. You may be able to fix things by running:

    fink scanpackages
    sudo apt-get update
    sudo apt-get install libgettext3-dev=0.14.5-2

    Failed: Fink::SysState: Could not resolve inconsistent dependencies

    What to do?

    I did the above and it appears to be building some GCC4.4 files in /sw. Let's see...
     
  13. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #13
    This time the installation completed without a warning message, so I assume it worked, but I still haven't found a gcc-4.4 executable... There are however, some filenames containing gcc44 with extension info, patch and deb, notably

    gcc44_4.4.1-1000_darwin-i386.deb​

    I thought that deb was a package expander, not a package itself.

    Would someone suggest where to take it from here?
     
  14. er2020 thread starter macrumors newbie

    Joined:
    Aug 14, 2010
    #14
    $ cd /sw/fink/10.4/stable/main/binary-darwin-i386/languages/
    $ sudo dpkg -i gcc44_4.4.1-1000_darwin-i386.deb

    is apparently what was needed.
     

Share This Page