Closed 201zxming closed 5 months ago
check the lines in /home/judge/etc/judge.conf
#use next two lines to overide C/C++ standard
OJ_CC_STD=-std=c99
OJ_CPP_STD=-std=c++17
#OJ_CC_OPT=-O2
and if not found , check /home/judge/src/core/judge_client/judge_client.cc
if(__GNUC__ > 9 || ( __GNUC__ == 9 && __GNUC_MINOR__ >= 3 ) ){
// ubuntu20.04 introduce g++9.3
strcpy(cc_std,"-std=c17");
strcpy(cpp_std,"-std=c++14"); // CCF NOI change settings for NOIP to C++14 on 2021-9-1
}else{
strcpy(cc_std,"-std=c99");
strcpy(cpp_std,"-std=c++11");
}
and the compiler version in Docker can be found by run code in TEST_RUN
#include <stdio.h>
int main()
{
printf("%d.%d.%d\n",__GNUC__,__GNUC_MINOR__ ,__GNUC_PATCHLEVEL__);
return 0;
}
在 /home/judge/etc/judge.conf OJ_CC_STD=-std=c99 OJ_CPP_STD=-std=c++17 打开这2行配置后重启了判题机(安装 的时候这2行配置是默认屏蔽掉的),报错了: g++: error: unrecognized command line option ‘-std=c++17’
看来是不支持 C++ 17?
说明你的ubuntu版本较老 ?
请问是不是升级 GCC 版本才行呢? 当前机器 gcc 4.8.5 的
建议备份数据后重装操作系统为ubuntu22.04,然后用最新脚本安装,最后还原备份数据。
如果要升级到 支持C++20的话,以下配置该怎么写呢: 在 /home/judge/etc/judge.conf 的 OJ_CC_STD=-std=c99 OJ_CPP_STD=-std=c++17
我这里是一台centos7.5, 试了下直接安装 最新版本的gcc也是有效的,主要以下几个操作(没有改 /home/judge/etc/judge.conf):
yum -y install centos-release-scl yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
echo "source /opt/rh/devtoolset-11/enable" >>/etc/profile source /etc/profile
gcc --version
cd /home/judge/src/core && sudo pkill -9 judged && ./make.sh && judged
想 确认当前安装 的hustoj 中 c++编译器 是哪个版本。 比如 c++17 还是 c++20 。