Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Various forms of "cpp -v" to get the output into a file that I can edit have all failed.
I used [Search forums] from the Home page and got zero returns for cpp -v and for "cpp -v".
Assuming there is no rather simple answer to getting that, here is exactly what I hoped to get out of cpp -v which I can see on the console but cannot capture (except by using "script" which introduces additional problems).
Though I am baffled why various forms of "put the output into a file" fail, what got me off on to the "cpp -v" was the desire to know very specifically which c header files went into my compilation.
I am using Debian Linux 4.9.2-10 and gcc 4.9.2 (with some security updates).
Pointers about why my Search Forums failed for "cpp -v" may be illuminating.
Pointer about which forum for this kind of question is more appropriate in will help.
Last edited by ge||ge; 05-07-2020 at 08:37 PM.
Reason: Had gcc on the brain, but question was for cpp.
Various forms of "cpp -v" to get the output into a file that I can edit have all failed.
cpp isn't meant to be run standalone, and especially not without a filename, it will wait (forever) for the file data to come in through standard input. From the man page
Note that infile and outfile arguments both are obligated. Another quote
Quote:
The C preprocessor is intended to be used only with C, C++, and Objective-C source
code. In the past, it has been abused as a general text processor. It will choke
on input which does not obey C's lexical rules.
Various forms of "cpp -v" to get the output into a file that I can edit have all failed.
Pointers on what did you try exactly may help....
Pointers on what did you search exactly may help...
Pointers on what did you want to achieve at all may help...
To redirect output to a file, use the greater sign.
To redirect standard error to a file, use the double greater sign.
To redirect both, use one of these expressions:
To redirect output to a file, use the greater sign.
To redirect standard error to a file, use the double greater sign.
No, >> means: redirect stdout and APPEND to the file it redirects TO, so do not overwrite that
To redirect standard error you have to use 2> (redirect the "2" handle) in bash and sh-like shells. That's why 2>&1 works to redirect both: you redirect "2" to where "1" (stdout) is already going. That's why it has to be behind any redirection for 1 (the default is that both 1 and 2 go to the screen).
The standard file descriptors are
0 standard input (stdin), so used for < input redirection
1 standard output (stdout), so 1> is the same as just >
2 standard error (sterr), always needs an explicit 2
and from 3 on are free for the program code to use for files.
See the chapter "REDIRECTION" in the bash man page too.
Pointers on what did you try exactly may help....
Pointers on what did you search exactly may help...
Pointers on what did you want to achieve at all may help...
This is the newbie forum. I tried not to put in so much information that it become TL;DR.
Search LinuxQuestions.org all forums using "cpp -v" or without the quotes. The zero (of less) results were what I thought I reported, but I am new to what I am expected to report.
In my 4th paragraph I thought I made it clear why I was at all interested in "cpp -v".
cpp isn't meant to be run standalone, and especially not without a filename, it will wait (forever) for the file data to come in through standard input. From the man page
Note that infile and outfile arguments both are obligated. Another quote
So the input has to look a lot like C
That infile outfile failed just as many other attempts did to get the output into a file.
What did work was to ignore the outfile requirement and use &>/tmp/a.
It did not occur to me that *all* that verbiage was an stderr response. In retrospect I have only seen short (1 or 2 lines) of stderr which I have generally had no interest in capturing. I suppose the "-v" also threw me off, but I guess one can have "verbose" stderr, too. I was using a suggestion from StackOverflow where it was shown (to someone several years ago) that cpp -v /dev/null /dev/null displayed what I wanted .... on the console screen. No one hinted that what was seen there was all known to be error output.
Though not impressed in my first forum outing here with the majority of replies, yours was the most informational, if not precisely an answer. I'm marking it SOLVED .. with a education to boot. Thanks.
This is the newbie forum. I tried not to put in so much information that it become TL;DR.
Search LinuxQuestions.org all forums using "cpp -v" or without the quotes. The zero (of less) results were what I thought I reported, but I am new to what I am expected to report.
In my 4th paragraph I thought I made it clear why I was at all interested in "cpp -v".
Actually you started with gcc -v which is not cpp -v. So that was a bit misleading for me. Fortunately others understood your post better.....
Actually you started with gcc -v which is not cpp -v. So that was a bit misleading for me. Fortunately others understood your post better.....
I did make that error. As a newbie for LinuxQuestions I didn't "sit" on my preview. As you might nod at, I use gcc one heck of a lot more than cpp and have had questions (elsewhere) about gcc switches. I am surprised I caught my rather drastic error as fast as I did ... but not as fast as y'all did.
I would have guessed that most active LQ readers who ever post would let "newbie" questions percolate for a few hours (and let newer LQ members answer the rather easy "newbie" questions) before helping out.
I am impressed how quickly members are willing to help out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.