Overview Description:

GCC version: 4.4.1

System info: 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686
GNU/Linux, Ubuntu 9.10

GCC I used was the Ubuntu 9.10 native c++ compiler, installed using Synaptic
package manager.

The case is the following: 
There are two files to be compiled: cpp and hpp.
x.hpp contains only the f() function prototype.
x.cpp contains the f() function implementation and main().
x.cpp file includes the x.hpp.

g++ -c x.hpp - this command generates x.hpp.gch file.

After this the command

g++ x.cpp 

gives the following error:

x.cpp: In function ‘int f()’:
x.cpp:3: error: redefinition of ‘int f()’
x.hpp:2: error: ‘int f()’ previously defined here.

In some cases it is not reproducible.


-- 
           Summary: GCC 4.4.1 problems with include
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nar dot martirosyan at gmail dot com


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

Reply via email to