Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22002

How to get the error compiler gcc message with shell_exec() using php in windows platform?

$
0
0

When I try to compile C file with a correct syntax using shell_exec() function its work fine, but the the problem is when I do a mistake in the C syntax. I can't get the error message from the output

php code :

<?phpecho shell_exec("gcc C:\\xamppp\\htdocs\\testor\\filec.c -o C:\\xamppp\\htdocs\\testor\\filec.exe");?>

filec.c code:

#include <stdio.h>int main(){print("hello C!");//i wrote print to get an error message}

cmd command :

**gcc filec.c -o filec.exe**filec.c: In function 'main':filec.c:3:1: warning: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]    3 | print("hello C!");      | ^~~~~      | printfc:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:\Users\escanor\AppData\Local\Temp\ccgCM4xv.o:filec.c:(.text+0x16): undefined reference to `print'collect2.exe: error: ld returned 1 exit status

but nothing displayed in the browser.


Viewing all articles
Browse latest Browse all 22002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>