zhblue / hustoj

Popular Open Source Online Judge based on PHP/C++/MySQL/Linux for ACM/ICPC and NOIP training, with easy installation. 开源OJ系统
http://www.hustoj.com/?cat=2
GNU General Public License v2.0
3.33k stars 773 forks source link

关于函数return 返回值的问题 #843

Open youyu opened 2 years ago

youyu commented 2 years ago

在loj,一本通oj上,如果自定义函数有返回值,而实际答题过程中,由于用不到,忘了,hustoj可以通过,LOJ和一本通OJ会运行错误??怎么修改,才能让程序更严谨

zhblue commented 2 years ago

https://github.com/zhblue/hustoj/compare/9e043c7441b09cd91422571c4b50d1035e91bb78...8c57e3d39c24c64360c8a56fbb6f7cc28f395746

youyu commented 2 years ago

按照提示修改了,但是g++ -o judge_client judge_client.cc 没通过,有错误,可以直接下载github上的judge_client.o 不?

zhblue commented 2 years ago

编译用make命令

melongist commented 2 years ago

There is some error... judge_client.cc

in hustoj.tar.gz

at judge_client.cc

line 2839 line 2840

there is error ... double }

... } } ????

zipederror
zhblue commented 2 years ago

https://github.com/zhblue/hustoj/blob/master/trunk/core/judge_client/judge_client.cc#L2840

only one {

youyu commented 2 years ago

编译用make命令

能否提供一个编译好的,新的judge_client.o ,这样是不是下载到对应文件夹下,就可以了

melongist commented 2 years ago

https://github.com/zhblue/hustoj/blob/master/trunk/core/judge_client/judge_client.cc#L2840

only one {

but in unzipped judge_client.cc file at ./src/core/

there is double }} :(

I don't know why.... ?

zhblue commented 2 years ago

package script caused a conflict, fixed.

melongist commented 2 years ago

package script caused a conflict, fixed.

Thank you~ it works properly~ :)

youyu commented 2 years ago

请问能分享一些您新编译的judge_client吗?

melongist commented 2 years ago

请问能分享一些您新编译的judge_client吗?

How to compile~ at command terminal...

cd

cd /home/judge/src/core

sudo bash make.sh

If you use Ubuntu 22.04 LTS ?

sudo -s

cd

cd /home/judge/src/core

sudo bash make.sh

exit
youyu commented 2 years ago

请问能分享一些您新编译的judge_client吗?

How to compile~ at command terminal...

cd

cd /home/judge/src/core

sudo bash make.sh

If you use Ubuntu 22.04 LTS ?

sudo -s

cd

cd /home/judge/src/core

sudo bash make.sh

exit

I did like this,but it doesn't work

youyu commented 2 years ago

程序没有实现,非void类型函数,必须有返回值的功能

zhblue commented 2 years ago

哦,之前没看懂你的问题。 试试给gcc加上参数-Wreturn-type -Werror=return-type

zhblue commented 2 years ago

https://github.com/zhblue/hustoj/blob/master/trunk/core/judge_client/judge_client.cc#L1272