我正在做这个项目,可以使用g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
和在我的桌面上进行编译cmake version 2.8.12.2
。
我是travis-ci的新手,我写了一个.travis.yml
脚本,如下
language: cpp
compiler:
- g++
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- libboost-all-dev
- cmake
install:
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8 -std=c++11 -I/usr/include/boost -DENABLE_REINFORCEMENT_LEARNING" CC="gcc-4.8"; fi
before_script:
- mkdir build
- cd build
- cmake ..
script: make
我的项目具有boost
库依赖性。
我的问题是travis-ci指示我的timer
变量中存在编译器错误。
#include "stdafx.hpp"
#include <list>
#include <mutex>
#include <atomic>
#include <thread>
#include <fstream>
#include <sstream>
#include <signal.h>
#include <iostream>
#include <functional>
#include "timer.hpp"
#include "configs.hpp"
#include "incurses.hpp"
#include "quadrotor.hpp"
#include "main.helper.hpp"
#include "main.output.hpp"
#ifdef ENABLE_REINFORCEMENT_LEARNING
# include "RLearner.Sarsa.hpp"
#endif
volatile bool
sig_ctrl_c = false;
std::mutex log_lock;
> timer screener; <
// /home/travis/build/noise2/quadrotor-sim/main.cpp:27:1: error: ‘timer’ does not name a type
// timer screener;
scalar iter_simulation = 0;
const size_t max_iter_simulation = 1e+5;
您可以在此处查看travis-ci结果。
1)为什么在桌面上成功编译后,这到底是一个错误?(即我做错了什么?)
2)如何使我的项目通过travis-ci?
请注意,该类
timer
已经包含在内。
感谢@nfranklin,我注意到了问题所在。为了解决这个问题,我必须安装最新的boost版本之一,因此提出了以下travis.yml
脚本。
language: cpp
compiler:
- g++
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- boost-latest
packages:
- gcc-4.8
- g++-4.8
- libboost1.55-all-dev
- cmake
install:
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8 -std=c++11 -DENABLE_REINFORCEMENT_LEARNING" CC="gcc-4.8"; fi
before_script:
- mkdir build
- cd build
- cmake ..
script: make
现在一切都很好:)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句