http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54163
Bug #: 54163 Summary: Ignore -l[lib] option on PCH generation Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: pch AssignedTo: unassig...@gcc.gnu.org ReportedBy: pavel.v.chu...@gmail.com This case doesn't work: $ g++ t.H -o t.H.gch -lfoo -L. /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status Adding -c solve the issue: $ g++ t.H -o t.H.gch -lfoo -L. -c Nevertheless without -l switch gcc generates precompiled header even without -c and doesn't complain on main. All these cases works fine: $ g++ t.H -o t.H.gch -c $ g++ t.H -o t.H.gch $ g++ t.H Does it make sense to allow PCH generation with -l?