This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to just print the output for -H without output anything else?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]