* How to just print the output for -H without output anything else?
@ 2019-01-04 2:21 Peng Yu
2019-01-04 2:41 ` Xi Ruoyao
0 siblings, 1 reply; 10+ messages in thread
From: Peng Yu @ 2019-01-04 2:21 UTC (permalink / raw)
To: gcc-help
Hi,
I just want to print the header information. Is there a way to
suppress the errors generated (Undefined symbols ...)? Thanks.
$ gcc -H -Iincdir main.c
. ./main.h
.. ./print.h
. incdir/print1.h
Undefined symbols for architecture x86_64:
"_print", referenced from:
_main in main-9c47c5.o
"_print1", referenced from:
_main in main-9c47c5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
==> main.c <==
// vim: set noexpandtab tabstop=2:
#include "main.h"
#include <print1.h>
int main() {
print();
print1();
}
==> print.c <==
#include <stdio.h>
void print() {
puts("Hello World!");
}
==> incdir/print1.c <==
#include <stdio.h>
void print1() {
puts("Hello World1!");
}
==> incdir/print1.h <==
// vim: set noexpandtab tabstop=2:
void print1();
--
Regards,
Peng
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 2:21 How to just print the output for -H without output anything else? Peng Yu
@ 2019-01-04 2:41 ` Xi Ruoyao
2019-01-04 3:19 ` Peng Yu
0 siblings, 1 reply; 10+ messages in thread
From: Xi Ruoyao @ 2019-01-04 2:41 UTC (permalink / raw)
To: Peng Yu; +Cc: gcc-help
On 2019-01-03 20:21 -0600, Peng Yu wrote:
> Hi,
>
> I just want to print the header information. Is there a way to
> suppress the errors generated (Undefined symbols ...)? Thanks.
>
> $ gcc -H -Iincdir main.c
> . ./main.h
> .. ./print.h
> . incdir/print1.h
> Undefined symbols for architecture x86_64:
> "_print", referenced from:
> _main in main-9c47c5.o
> "_print1", referenced from:
> _main in main-9c47c5.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hmmm... clang :). Another off-topic thread caused by Apple Mac OS X.
A "-c" option would work.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 2:41 ` Xi Ruoyao
@ 2019-01-04 3:19 ` Peng Yu
2019-01-04 6:42 ` Xi Ruoyao
0 siblings, 1 reply; 10+ messages in thread
From: Peng Yu @ 2019-01-04 3:19 UTC (permalink / raw)
To: Xi Ruoyao; +Cc: gcc-help
> A "-c" option would work.
This still generates the .o file. Is there an option that disable all
the side effect but just print the header info as -H?
--
Regards,
Peng
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 3:19 ` Peng Yu
@ 2019-01-04 6:42 ` Xi Ruoyao
2019-01-04 8:42 ` Alexander Monakov
2019-01-04 15:26 ` Peng Yu
0 siblings, 2 replies; 10+ messages in thread
From: Xi Ruoyao @ 2019-01-04 6:42 UTC (permalink / raw)
To: Peng Yu; +Cc: gcc-help
On 2019-01-03 21:18 -0600, Peng Yu wrote:
> > A "-c" option would work.
>
> This still generates the .o file. Is there an option that disable all
> the side effect but just print the header info as -H?
Maybe "-E -o /dev/null"? Use "-E" instead of "-c" so the compiler and
assembler will not run, and "-o /dev/null" to throw the result
(preprocessed code).
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 6:42 ` Xi Ruoyao
@ 2019-01-04 8:42 ` Alexander Monakov
2019-01-04 15:26 ` Peng Yu
1 sibling, 0 replies; 10+ messages in thread
From: Alexander Monakov @ 2019-01-04 8:42 UTC (permalink / raw)
To: Xi Ruoyao; +Cc: Peng Yu, gcc-help
On Fri, 4 Jan 2019, Xi Ruoyao wrote:
> On 2019-01-03 21:18 -0600, Peng Yu wrote:
> > > A "-c" option would work.
> >
> > This still generates the .o file. Is there an option that disable all
> > the side effect but just print the header info as -H?
>
> Maybe "-E -o /dev/null"? Use "-E" instead of "-c" so the compiler and
> assembler will not run, and "-o /dev/null" to throw the result
> (preprocessed code).
There's also -fsyntax-only, but it does more work compared to -E -o/dev/null.
Alexander
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 6:42 ` Xi Ruoyao
2019-01-04 8:42 ` Alexander Monakov
@ 2019-01-04 15:26 ` Peng Yu
2019-01-04 15:28 ` Jonathan Wakely
1 sibling, 1 reply; 10+ messages in thread
From: Peng Yu @ 2019-01-04 15:26 UTC (permalink / raw)
To: Xi Ruoyao; +Cc: gcc-help
On Fri, Jan 4, 2019 at 12:42 AM Xi Ruoyao <xry111@mengyan1223.wang> wrote:
>
> On 2019-01-03 21:18 -0600, Peng Yu wrote:
> > > A "-c" option would work.
> >
> > This still generates the .o file. Is there an option that disable all
> > the side effect but just print the header info as -H?
>
> Maybe "-E -o /dev/null"? Use "-E" instead of "-c" so the compiler and
> assembler will not run, and "-o /dev/null" to throw the result
> (preprocessed code).
Thanks. This works.
Is there a way to further strip off systems headers as in -MM? Thanks.
--
Regards,
Peng
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 15:26 ` Peng Yu
@ 2019-01-04 15:28 ` Jonathan Wakely
2019-01-04 15:32 ` Peng Yu
0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2019-01-04 15:28 UTC (permalink / raw)
To: Peng Yu; +Cc: Xi Ruoyao, gcc-help
On Fri, 4 Jan 2019 at 15:26, Peng Yu <pengyu.ut@gmail.com> wrote:
>
> On Fri, Jan 4, 2019 at 12:42 AM Xi Ruoyao <xry111@mengyan1223.wang> wrote:
> >
> > On 2019-01-03 21:18 -0600, Peng Yu wrote:
> > > > A "-c" option would work.
> > >
> > > This still generates the .o file. Is there an option that disable all
> > > the side effect but just print the header info as -H?
> >
> > Maybe "-E -o /dev/null"? Use "-E" instead of "-c" so the compiler and
> > assembler will not run, and "-o /dev/null" to throw the result
> > (preprocessed code).
>
> Thanks. This works.
>
> Is there a way to further strip off systems headers as in -MM? Thanks.
You're not using GCC, so maybe you should ask on a Clang list.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 15:28 ` Jonathan Wakely
@ 2019-01-04 15:32 ` Peng Yu
2019-01-04 15:33 ` Jonathan Wakely
0 siblings, 1 reply; 10+ messages in thread
From: Peng Yu @ 2019-01-04 15:32 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Xi Ruoyao, gcc-help
The options are the same for this purpose. I am just running the test
on Mac OS X. But I could use Linux as well. I don't think the results
are different.
On Fri, Jan 4, 2019 at 9:28 AM Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Fri, 4 Jan 2019 at 15:26, Peng Yu <pengyu.ut@gmail.com> wrote:
> >
> > On Fri, Jan 4, 2019 at 12:42 AM Xi Ruoyao <xry111@mengyan1223.wang> wrote:
> > >
> > > On 2019-01-03 21:18 -0600, Peng Yu wrote:
> > > > > A "-c" option would work.
> > > >
> > > > This still generates the .o file. Is there an option that disable all
> > > > the side effect but just print the header info as -H?
> > >
> > > Maybe "-E -o /dev/null"? Use "-E" instead of "-c" so the compiler and
> > > assembler will not run, and "-o /dev/null" to throw the result
> > > (preprocessed code).
> >
> > Thanks. This works.
> >
> > Is there a way to further strip off systems headers as in -MM? Thanks.
>
> You're not using GCC, so maybe you should ask on a Clang list.
--
Regards,
Peng
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 15:32 ` Peng Yu
@ 2019-01-04 15:33 ` Jonathan Wakely
2019-01-04 16:46 ` Peng Yu
0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2019-01-04 15:33 UTC (permalink / raw)
To: Peng Yu; +Cc: Xi Ruoyao, gcc-help
On Fri, 4 Jan 2019 at 15:32, Peng Yu <pengyu.ut@gmail.com> wrote:
>
> The options are the same for this purpose. I am just running the test
> on Mac OS X. But I could use Linux as well. I don't think the results
> are different.
I don't care what OS you're using, I only care what compiler you're
using. You're not using GCC, you're using Clang pretending to be GCC.
That's still not GCC, it's Clang.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to just print the output for -H without output anything else?
2019-01-04 15:33 ` Jonathan Wakely
@ 2019-01-04 16:46 ` Peng Yu
0 siblings, 0 replies; 10+ messages in thread
From: Peng Yu @ 2019-01-04 16:46 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Xi Ruoyao, gcc-help
I am saying the default on Linux is gcc.
On Fri, Jan 4, 2019 at 9:33 AM Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:
> On Fri, 4 Jan 2019 at 15:32, Peng Yu <pengyu.ut@gmail.com> wrote:
> >
> > The options are the same for this purpose. I am just running the test
> > on Mac OS X. But I could use Linux as well. I don't think the results
> > are different.
>
> I don't care what OS you're using, I only care what compiler you're
> using. You're not using GCC, you're using Clang pretending to be GCC.
> That's still not GCC, it's Clang.
>
--
Regards,
Peng
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-01-04 16:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 2:21 How to just print the output for -H without output anything else? Peng Yu
2019-01-04 2:41 ` Xi Ruoyao
2019-01-04 3:19 ` Peng Yu
2019-01-04 6:42 ` Xi Ruoyao
2019-01-04 8:42 ` Alexander Monakov
2019-01-04 15:26 ` Peng Yu
2019-01-04 15:28 ` Jonathan Wakely
2019-01-04 15:32 ` Peng Yu
2019-01-04 15:33 ` Jonathan Wakely
2019-01-04 16:46 ` Peng Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).