Jump to content
xisto Community
Sign in to follow this  
kanade

Linux Basic Command - For Storing Compilation Error To File

Recommended Posts

Ex: Compiling a cpp file using a basic command "g++ filename.cpp" and to run the program use ./a.out, Then to store the compilation error to text file use this command.

 

g++ test.cpp > log.txt

 

log.txt contains the compile time errors.

Share this post


Link to post
Share on other sites

If your code is giving core dump or segmentation fault then the easiest way to debug the error is using the gdb and file created by coredump.example: use this command to compile the code $ gcc -g -o outfile sample.cpp use this command to run this. $ ./outfile -- if you get message segmentation fault or core dump then look for the coredump file created in perticular folder the use following command to debug it. $gdb coredumpfilename --- this will display where exactly code is created a dump. You can use 'bt' command to back trace the error.enjoy error free coding ............

Edited by kanade (see edit history)

Share this post


Link to post
Share on other sites
compilation error logsLinux Basic Command - For Storing Compilation Error To File

Hi

I tried to store compilation error logs using

=>gcc test.C > test.Log

but instead of writing errors to file, it is printing errors on STDOUT. I'm using gcc 4.1.2 and RHEL 5.1. Any suggestions?

Regards,

Pankaj

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.