C++14系列(1):Linux下C++14開發環境配置

來源:互聯網
上載者:User

標籤:.text   provider   func   eclipse   int   14.04   屬性   read   pen   

g++安裝

參考地址:
http://sysads.co.uk/2014/07/install-gcc-gnu-4-9-1-on-ubuntu-14-04/

當前Ubuntu的LTS版本號碼為14.04,直接在apt-get命令安裝的g++到不了5.0版本號碼,不能獲得所有的c++14的支援。所以必須安裝5.0以上版本號碼的g++。這裡的方法例如以下:

sudo add-apt-repository ppa:ubuntu-toolchain-r/testsudo apt-get updatesudo apt-get install g++-5

– Remove the previous g++ version from the default applications list (if already exists)

sudo update-alternatives --remove-all gcc

– Make G++ 5 the default compiler on the system

sudo update-alternatives –install /usr/bin/g++ g++ /usr/bin/g++-5 20

sudo update-alternatives –config g++

使用

g++ --version

查看g++版本號碼資訊

Eclipse CDT安裝

到Eclipse開源project網站下載新版的CDT開發環境,須要先安裝好JAVA執行環境。網上一搜都是。略。

Eclipse CDT內部配置與project配置

參考:
http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support

在建立project前,配置 Eclipse syntax parser:
詳細步驟:
Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build-in Compiler Settings

在 Command to get compiler specs 加上 -std=c++14

建立一個C++project:

For project created as: File -> New -> Project -> C/C++ -> C++ Project

右擊project開啟屬性:

Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Dialect

加上 -std=c++14 到 other dialect flags

另外,為瞭解析和索引新版的一些文法:
Properties -> C/C++ General -> Preprocessor Include Paths, Marcos etc. -> Providers

enable CDT GCC Build-in Compiler Settings and move it higher then Contributed PathEntry Containers (重要)

最後

又一次編譯
又一次產生索引: Project ->C/C++ Index
重新啟動 Eclipse.

開始C++14之旅

開始拍代碼吧~

C++14系列(1):Linux下C++14開發環境配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.