Travis CI with C ++ 14 and Linux

Similar: Travis CI with Clang 3.4 and C ++ 11

How to make Travis CI work with C ++ 14?

Here is our current .travis.yml file:

 language: cpp compiler: - gcc - clang os: - linux - osx script: make main 

Here is our makefile

 # Factor Pro # Macros CXXFLAGS = -Os -std=c++14 # Rules all::main main: main.cpp g++ -o main $(CXXFLAGS) main.cpp clean: rm -rf *.o main 

It works on osx , but not linux .

+6
source share
1 answer

The standard versions of GCC and Clang are terribly outdated, and you will need to install newer versions manually as follows:

 language: generic os: osx matrix: include: - os: linux env: COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5 addons: apt: packages: - g++-5 sources: &sources - llvm-toolchain-precise-3.8 - ubuntu-toolchain-r-test - os: linux env: COMPILER_NAME=clang CXX=clang++-3.8 CC=clang-3.8 addons: apt: packages: - clang-3.8 sources: *sources 

You can install several versions of Clang and GCC, for example.

Note. I use language: generic because if language: cpp , TravisCI horribly-outdated CC and CXX redefines the export of each cell and faster.

I also recommend that you use

  $(CXX) -o main $(CXXFLAGS) main.cpp 

Because the C ++ compiler was almost never g++ in the real world.

+11
source

All Articles