1 year ago

#376461

test-img

kilomikesierra

Using 'extern' inside class gives me 'storage class specified' error

I'm trying to use "Graph" variable globally.

I have no problem defining it in class without 'extern', but when I add 'extern', it gives following error. What's wrong and right way to use it? Thank you.

Error message I got :

 error: storage class specified for ‘g2_’
                 extern Graph    g2_;
                                 ^~~

Header File :

namespace ompl
{
    namespace geometric
    {
        class AAA: public PRM   
        {
        public:
                        
            typedef boost::adjacency_list <
                boost::vecS, boost::vecS, boost::undirectedS,
                boost::property < vertex_state_t, base::State*,
                boost::property < vertex_total_connection_attempts_t, unsigned long int,
                boost::property < vertex_successful_connection_attempts_t, unsigned long int,
                boost::property < boost::vertex_predecessor_t, unsigned long int,
                boost::property < boost::vertex_rank_t, unsigned long int > > > > >,
                boost::property < boost::edge_weight_t, base::Cost >
            > Graph;

            extern Graph    g2_;
        };
    }
}

#endif

c++

class

extern

0 Answers

Your Answer

Accepted video resources