SpiralTest.h
#ifndef SPIRALTEST_H_
#define SPIRALTEST_H_
namespace eveready
{
struct TNotes{
int pie;
void meth();
};
extern TNotes tell;
}
#endif /* SPIRALTEST_H_ */
SpiralTest.cpp
#include "SpiralTest.h"
namespace eveready
{
void TNotes::meth(){
pie=0;
}
}
now i am trying to access variable pie into abc.cpp
abc.cpp
#include "SpiralTest.h"
using namespace eveready;
tell.meth();
but it shows error when i compile (.text+0x49): undefined reference to `eveready::tell'
i tried also `eveready::tell.meth(); but again it shows same error. what should i do..?
This
is just a declaration of name
tell. You have to define the corresponding object for example inabc.cppTake into account that the function call has to be in some other function. It may not be in a namespace.