[Bug c/30692] New: GCC automatically fails to preprocess files with the "hpp" file extension

k04jg02 at kzoo dot edu gcc-bugzilla@gcc.gnu.org
Sat Feb 3 15:04:00 GMT 2007


I want to use gcc's -E option to just have the preprocessor run on one of my
header files, to see if some macros expand correctly. GCC will do this happily
if the file's extension is .h, but not if it is .hpp. You can see this
trivially by typing in at the console:

$ touch blah.hpp
$ gcc -E blah.hpp
gcc: blah.hpp: linker input file unused because linking not done

I think this is because gcc uses the file extension to determine that you
probably want to compile C++ and so tries to link the libstdc++. But if you use
-E you don't want to link anything! You're just trying to use the preprocessor
to see if your macros are working. Renaming the file to have a ".h" extension
fixes the problem. Using g++ instead of gcc gives the same error.

I'm using gcc on Ubuntu Edgy, here's the --version line:

gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- 
           Summary: GCC automatically fails to preprocess files with the
                    "hpp" file extension
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: k04jg02 at kzoo dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30692



More information about the Gcc-bugs mailing list