LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2003, 07:28 PM   #1
davmer
LQ Newbie
 
Registered: Mar 2003
Location: Tasmania, Australia..the best place in the world..clean air & clean water..purely subjective of course!!!
Distribution: Red Hat 8.0
Posts: 20

Rep: Reputation: 0
Question g++ compiler listings


now that i have started to compile i have a question re compiler listing output

I have searched this site trying to find how to get a compiler listing output from g++. further can i specify with options whether or not i choose to show user includes and/or system includes to prevent verbosity

I have used indirection to get my errors to a file ok with either &> filename.lst or 2> filename.lst
so for e.g
g++ test.cpp -o test 2> test.err

gave me my errors in a nice file which i can look at with cat but they were truncated so that i could not read the full text of the message

I have looked at all of the g++ options with man on my platform and no option seems to relate to compiler listings
 
Old 03-20-2003, 09:48 PM   #2
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I take it you're saying that a message on a particular line is cut off? Maybe there is some limit to the size of lines that can be redirected.

Looking through the man page for your shell (csh, bash, etc.) might give you more info about this. I don't know of any compiler options to cut down on the length of error messages, but you might check out the g++ man page too.

Are the errors really cut off so much that you can't figure out how to fix the error? Most of the time, if you have a source file name, and a line number, you can figure out what the error is, and then you don't even need to read the whole message.
 
Old 03-20-2003, 11:10 PM   #3
davmer
LQ Newbie
 
Registered: Mar 2003
Location: Tasmania, Australia..the best place in the world..clean air & clean water..purely subjective of course!!!
Distribution: Red Hat 8.0
Posts: 20

Original Poster
Rep: Reputation: 0
hi wapcaplet,

the options i am after are ones which produce a listing of the program post compile with the includes expanded, cross reference list,etc. On a platform (IBM AS400) that i work on at work we can even specify whether or not you get a print and if printing whether to expand system includes and/or user includes plus a whole lot of other things.

the output i get from the g++ compiler is truncated...i will try and give you an example of what i am getting...and no because of truncation i cannot interpret what the warning messages are saying to me as the sentences are incomplete
 
Old 03-20-2003, 11:36 PM   #4
GtkUser
Member
 
Registered: Sep 2002
Location: Canada
Distribution: Redhat 9.0
Posts: 637

Rep: Reputation: 30
It's not truncated on my system. The Complete Reference GCC is a book with all kinds of information on gcc and g++. You can get this information online as well I think < http://gcc.gnu.org/ >.
 
Old 03-21-2003, 09:09 AM   #5
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
Are you sure your terminal isn't set to truncate long lines? Try viewing the contents of the output file with vi. I don't think g++ is the one that is truncating the lines.
 
Old 04-30-2006, 05:06 AM   #6
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Sorry to revive an old thread, but I have the same question as the OP, and it didn't get answered.

For you guys who never programmed in the days when compilers produced listings this may sound strange. Judging from the confusion generated by this thread, everybody is familiar with error listings. But we want a source listing which is a listing generated by the compiler, showing the source code, with line numbers and other annotations, like offsets to names in structures, lengths of structures and their members, etc.

I have not been able to find any mention of this in the gcc doc at gcc.gnu.org.

If anyone understands what we are asking for and knows if it's possible/not possible with gcc, please update this thread.

Quote:
On a platform (IBM AS400) that i work on at work we can even specify whether or not you get a print and if printing whether to expand system includes and/or user includes plus a whole lot of other things.
This is exactly what I want, because I want to see includes expanded in a nicely formatted way.

Thanks,
Randux

Last edited by Randux; 04-30-2006 at 05:08 AM.
 
Old 04-30-2006, 11:41 AM   #7
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
The gcc -E option stops after preprocessing, and you get the result to stdout.
 
Old 04-30-2006, 01:24 PM   #8
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Hi Randy,

That's not really what I was looking for, but it is certainly better than what I had until now! Thanks for your update. I sent a question to the gcc list and if I get anything work repeating I will update this thread.

For anyone else reading this, Randy's suggestion causes gcc to write the source with the includes expanded. This helps if you want to see all your source and includes in one place.
 
Old 04-30-2006, 05:43 PM   #9
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
Actually it does quite a bit more, it also shows all of the macro expansions. This option is most useful when trying to debug complex macro usages that don't seem to be compiling as expected.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory/File Listings AndeAnderson Debian 7 02-24-2005 12:59 AM
Multiple OS listings in grub loader Lorend Linux - Newbie 4 02-15-2005 11:13 AM
Scrape Website for TV listings drspangle Linux - Software 4 07-13-2004 04:20 AM
Apache directory listings Boffy Linux - Networking 8 04-30-2004 04:47 AM
driver listings? adam_boz Linux - General 3 10-22-2002 06:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration