structure does not name a type in c++

c++, compilation, struct

Solution

You are using `typedef` without giving a name to the type. Just drop the `typedef`, it is not needed here:

struct connection_header {
    string url;
    string method;
};

Next, `connection_header` is declared inside of the `Example` class, so you need to fully qualify its name in the implementation when it is a return type:

Example::connection_header Example::get_connection_header()

Problem

I get an issue while return type is structure ``` Example.h class Example { private: typedef struct connection_header { string url; string method; }; static connection_header get_connection_header(); }; Example.cpp connection_header Example::get_connection_header() { return NULL; } ``` I am getting `'connection_header' does not name a type` may i know why is this error

Original source

Related problems