“-std=gnu++0x”option for MacOS

后端 未结 3 1766
予麋鹿
予麋鹿 2021-01-14 01:06

I\'m trying to compile a CMake project which uses

set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} \"-Wall -std=gnu++0x\")

in the CMakeLists.txt fil

3条回答
  •  梦谈多话
    2021-01-14 01:35

    For Lion users facing this issue:

    Download and Install the MacPorts-2.2.1-10.7-Lion.pkg MacPorts installer package from here

    in a terminal, search for newer GCC versions:

    $  port search --name --glob 'gcc*' 
    

    install a newer version (I went with gcc5)

    $  sudo port install gcc5
    

    get the name of your new version, and set it as default

    $ port select --list gcc
    
    Available versions for gcc:
        llvm-gcc42
        mp-gcc5
        none (active)
    
    $ sudo port select --set gcc mp-gcc5
    

    open a new terminal and validate you're updated:

    $ c++ --version
    c++ (MacPorts gcc5 5.2.0_0) 5.2.0
    

提交回复
热议问题