Warning Anonymous namespace inside structure using function pointer

In my program:

//Put this code in a separate header file.
struct _S1;
typedef struct {int unused;} * RETVAL;

typedef RETVAL (*MyFunc) (void* result, void* ctx, struct _P1* s);
typedef struct _S1 {
    struct _S1 *parent;
    MyFunc f1;
} S1;

//In cpp file, include the above header file.

I get the following warning:

warning: ‘_S1’ has a field ‘_S1::f1’ whose type uses the anonymous namespace [enabled by default]
 typedef struct _S1 {
            ^

What is the meaning of this warning? What is the result of this warning in my code? How to get rid of this warning?

I am compiling gcc on Linux.

+4
source share
1 answer

The fact that you put your type definitions in the header strongly suggests that you use several source files to use this header and use these types.

, RETVAL - . _S1 . .

: . , , . , .

- . , .

+4

All Articles