板凳——————————————————c++(12)

// P 201 professional c++ 4th edition
#include
#include <string_view>
#include
#include
class SpreadsheetCell
{
public://p202
virtual ~SpreadsheetCell() = default;
virtual void set(std::string_view inString) = 0 ;
virtual std::string getString() const = 0 ;
};

class StringSpreadsheetCell : public SpreadsheetCell{
public:
virtual void set(std::string_view inString) override;
virtual std::string getString() const override;

private:
std::optional<std::string> mValue;

};

void StringSpreadsheetCell::set(std::string_view inString){
mValue = inString;
}

std::string StringSpreadsheetCell::getString() const{
return mValue.value_or("");
}

class DoubleSpreadsheetCell : public SpreadsheetCell{
public:
virtual void set(double inDouble) ;
virtual void set(std::string_view inString) override;
virtual std::string getString() const override;
//virtual double stringToDouble(std::string_view inString) const override;//8-2
private:
static std::string doubleToString (double inValue);
static double stringToDouble(std::string_view inValue);
std::optional mValue;

};

void DoubleSpreadsheetCell::set(double inDouble){
mValue = inDouble;
}

void DoubleSpreadsheetCell::set(std::string_view inString){
mValue = stringToDouble(inString);
}

std::string DoubleSpreadsheetCell::getString() const{
return (mValue.has_value() ? doubleToString(mValue.value()) : “”);
}

std::string DoubleSpreadsheetCell::doubleToString(double inValue) //8-2
{
return std::__cxx11::to_string(inValue);
}

double DoubleSpreadsheetCell::stringToDouble(std::string_view inString)
{
return strtod(inString.data(), nullptr);
}

int main()
{

return 0;

}
2020年05月05日 05时50分07秒
wannian07@wannian07-PC:~$ g++ -std=c++17 -o c17 c17.cpp
wannian07@wannian07-PC:~$ ./c17
./c17: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26’ not found (required by ./c17)

wannian07@wannian07-PC:~/Desktop$ su - root
密码:
root@wannian07-PC:~# strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_DEBUG_MESSAGE_LENGTH
root@wannian07-PC:~# sudo apt-get install libstdc++6
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
libstdc++6 已经是最新版 (6.3.0-18+deb9u1)。
下列软件包是自动安装的并且现在不需要了:
dconf-cli gir1.2-ibus-1.0
使用’sudo apt autoremove’来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

第一个反应是升级9.3.0. 软件都下载好了
但是还是有顾虑的, 万一安装不成功呢?
第二, 9.2.0 安装从早8:00~~16:00 求稳
第三, 有一个笨办法就是找个现成的libstdc++.so.6.0.27

把它拷到cp /home/wannian07/temp_gcc9.2/x86_64-pc-linux-gnu/libstdc+±v3/src/.libs/libstdc++.so.6.0.27 /usr/lib/x86_64-lin

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值