Open ecojuntak opened 8 years ago
Hi -- basically you just need to replace the /usr/bin/g++
part to your compiler path. Usually you don't need to do this if you're using Ubuntu and you have installed g++
, as it will be installed there by default.
I have replace the usr/bin/g++
part, but it still not work.
I found this error message on the terminal when i try to submit the answer
A PHP Error was encountered Severity: WarningMessage: exec(): Unable to fork [-o secret-68a550951829942d1acd6c2a35519343/7/source/source secret-68a550951829942d1acd6c2a35519343/7/source/source.cpp -O2 -s -static -lm 2>&1]Filename: /var/www/html/grader/application/controllers/Grader.phpLine Number: 169
Are you have solution for this error?
Replace with what? Seems like you're missing it? (Unable to fork [-o ...
)
I just delete the /usr/bin/g++
..
Hmm why? I said replace with your actual compiler path, if necessary
I have locate some path on my PC.
/usr/bin/g++
/usr/bin/g++-4.8
/usr/bin/g++-5
/usr/bin/i686-w64-mingw32-g++
/usr/bin/x86_64-linux-gnu-g++
/usr/bin/x86_64-linux-gnu-g++-4.8
/usr/bin/x86_64-linux-gnu-g++-5
/usr/bin/x86_64-w64-mingw32-g++
I have used /usr/bin/g++
but it still can't work.
What error did you get when you used /usr/bin/g++
?
A PHP Error was encountered Severity: WarningMessage: exec(): Unable to fork [/usr/bin/g++ -o secret-68a550951829942d1acd6c2a35519343/13/source/source secret-68a550951829942d1acd6c2a35519343/13/source/source.cpp -O2 -s -static -lm 2>&1]Filename: /var/www/html/grader/application/controllers/Grader.phpLine Number: 169
Hmm strange. Could you try running a very simple PHP file that just contains something like
<?php echo exec('/usr/bin/g++'); ?>
just to test whether your PHP settings is good?
it show nothing
Good. Then try putting some C++ file inside the folder secret-68a550951829942d1acd6c2a35519343
(e.g. test.cpp
), and then try compiling that file using the same exec()
command, e.g
<?php echo exec('/usr/bin/g++ -o /full/path/to/secret-68a550951829942d1acd6c2a35519343/test /full/path/to/secret-68a550951829942d1acd6c2a35519343/test.cpp'); ?>
use full path for the secret folder
It show nothing too
I have finished to install the grader, but I still confused to set the compile command. I don't know what this part mean
/usr/bin/g++ -o [PATH]/source [PATH]/source.cpp -O2 -s -static -lm
and this part[PATH]/source