does anyone know the command line syntax for the gcc compiler to output the compiler errors to a file?
does anyone know the command line syntax for the gcc compiler to output the compiler errors to a file?
You use file redirection based on your OS. Typically something like:But this isn't a compiler issue. It's just redirection. If there is such a flag, I haven't bothered to look for it, because redirection does it for me.Code:gcc -o foo foo.c -Wall -pedantic -ansi >& foo.txt
Quzah.
Hope is the first step on the road to disappointment.
I too redirect;
gcc prog.c -o prog.exe >somefile.txt
I looked throught the gcc documentation and could not find
an output for just errors:
http://gcc.gnu.org/onlinedocs
Thanks...I tried the
gcc prog.c -o prog.ex > somefile.txt
...and it created the file but the file was empty. I tried looking at their documentation too and I couldn't find anything either. I'm running this through Cygwin on my Win XP box.
So how about trying what I told you to try? I don't just make all this ........ up you know.
Quzah.
Hope is the first step on the road to disappointment.
Sorry...I was responding to the second poster first. I tried yours and it worked. I had to move the -o in the syntax. The -o went between somefile.c and somefile.exe. I then included what you stated and it worked so thank you.
The -o just has to go before the target executable, because it specifies the output file. Conventially, most people do:
Code:gcc -o <name of executable> <source file(s)> <flags>