c++: error: unrecognized command line option ‘-std=c++14’

opecc make安装出现 

c++: error: unrecognized command line option ‘-std=c++14’

 升级gcc 5.2后还是出现这个情况,后来找到直接指定cxx 位置后问题解决

我自己的做法是指定 CXX 的路径:

cmake -DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++ .

 后面又出现

[ 62%] Building STCharacters.ocd2
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ../src/tools/opencc_dict)
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ../src/tools/opencc_dict)
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/OpenCC-ver.1.1.2/src/libopencc.so.1.1)
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/OpenCC-ver.1.1.2/src/libopencc.so.1.1)
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/OpenCC-ver.1.1.2/src/libopencc.so.1.1)
../src/tools/opencc_dict: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/OpenCC-ver.1.1.2/src/libopencc.so.1.1)
make[2]: *** [data/STCharacters.ocd2] Error 1
make[1]: *** [data/CMakeFiles/Dictionaries.dir/all] Error 2
make: *** [all] Error 2

jie

执行以下命令,查找编译gcc时生成的最新动态库:

find / -name "libstdc++.so*"

把libstdc++.so.6.0.21拷贝到/usr/lib64目录下

1
cp ./libstdc++.so.6.0.21 /usr/lib64/

删除以前的libstdc++.so.6

1
rm -rf /usr/lib64/libstdc++.so.6

建立新连接

1
ln -s /usr/lib64/libstdc++.so.6.0.21 /usr/lib64/libstdc++.so.6

 

 

再执行make install 正常

 

执行 opencc --version 又出现如下提示

opencc: error while loading shared libraries: libopencc.so.1.1: cannot open shared object file: No such file or directory

 

直接下载rpm 包 安装 https://centos.pkgs.org/7/centos-x86_64/opencc-0.4.3-3.el7.x86_64.rpm.html

 

在执行 opencc --version  终于成功了

 

opencc 批量文件转繁体

#!/usr/bin/sh
#filename: t2s_batch.sh
# 符合后缀的文件才处理
if [ $# -ne 2 ];then
    echo "USAGE: $0 path_name file_suffix"
    exit
else
	lst=`find $1 -type f -name "*.$2"`
        lst_num=`find $1 -type f -name "*.$2"|wc -l`
 
        if [ $lst_num -eq 0 ];then
                echo "no such files."
        else
		for file in $lst
		do
		    echo $file
		    opencc -i $file -o $file -c t2s
		done
        fi
fi

  

posted @ 2021-04-12 21:43  私家菜地  阅读(5549)  评论(0编辑  收藏  举报