前几天,我决定让python命令默认启动python3而不是python2。
所以我这样做:
sudo update-alternatives --install /usr/bin/python python /usr/bin /python2.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 3
Run Code Online (Sandbox Code Playgroud)
sudo update-alternatives --config python
$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.5 3 auto mode
1 /usr/bin/python2.7 2 manual mode
2 /usr/bin/python3.5 3 manual mode
Press <enter> to keep the current choice[*], or type selection number: 0
Run Code Online (Sandbox Code Playgroud)
而且一切正常。大!:)
$ python -V
Python 3.5.2
Run Code Online (Sandbox Code Playgroud)
但是不久之后,我就意识到在安装和删除python软件包时我已经打破了apt / aptitude的范畴,因为apt期望python2能够实现。
就是这样
$ …Run Code Online (Sandbox Code Playgroud) 我在Red Hat Linux上使用Jenkins 2.6.我想在我的Jenkins文件中使用以下内容,但是当我尝试时,Jenkins抱怨道.(似乎只是不喜欢=运算符左侧的语法.):
def (a, b) = [6, 7]
Run Code Online (Sandbox Code Playgroud)
它似乎不喜欢Multiple Assignments,但Groovy 1.6及更高版本显然支持它们,根据这篇文章:
http://mrhaki.blogspot.co.uk/2009/09/groovy-goodness-multiple-assignments.html
我想这样做,以便当我调用一个返回[6,7]的方法时,我可以像这样调用它:
def (a, b) = mymethod()
def mymethod()
{
return [6, 7]
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我这是否适用于詹金斯,如果是这样,詹金斯的版本是什么?或者它是不受支持的功能?还是一个bug?
谢谢
我将Base类更改为抽象(即我将其中一个方法设为纯虚拟)并重新编译它.当我将它与派生类链接时,链接器抱怨了vtable.我用nm调查了一些事情,但我不确定nm告诉我的是什么.我只是通过删除*.o文件并重新编译Derived类来解决问题,但我想了解这里的vtable究竟发生了什么.
我的原始代码是这样的:
Base.h
class Base {
public:
virtual void doSomething();
};
Run Code Online (Sandbox Code Playgroud)
Base.cpp
#include <iostream>
#include <Base.h>
void Base::doSomething() {
std::cout << "Base::doSomething()" << "\n";
}
Run Code Online (Sandbox Code Playgroud)
Derived.h
#include <Base.h>
class Derived : public Base {
public:
Derived();
void doSomething() override;
};
Run Code Online (Sandbox Code Playgroud)
Derived.cpp
#include <iostream>
#include <Derived.h>
Derived::Derived() {
std::cout << "Derived::Derived() constructor" << "\n";
}
void Derived::doSomething() {
std::cout << "Derived::doSomething()" << "\n";
}
Run Code Online (Sandbox Code Playgroud)
Makefile包含以下内容:
CXXFLAGS = -std=c++14 -pedantic -Wall -Werror -I ./
default: build
clean:
rm -f proggy
rm -f …Run Code Online (Sandbox Code Playgroud)