symbol not exported:I have a variable in a .cpp file that gets built into a .so file. This variable added is not found during the linking process. Both the .so and executable existed- ie just added the new variable to an existing .cpp file w/o changing any build files.
Library:in one of the .cpp files: add the definition of a new variable:
std::vector<int> g_Timeout`enter code here`//Tried these w/o success:///init the variable to see if it is exportedstd::vector<int> g_Timeout={1} ;//add export symbol:EXPORT_SYMBOL(g_Timeout);
In .so file:
nm libTimeUtil.so | grep g_TimeoutU g_TimeoutU = undefined ?
Executable:
extern std::vector<int> g_Timeout;void SetDelay(std::vector<int>& vDelay){ g_Timeout.swap(vTimeout);}
Linker error while linking the executable:/apps/srini/eagle/feature/src/driver/DBLibModule.cpp:1295: undefined reference to `g_Timeout'
linker has the library added in the ldd command:lib library: 'TimeUtil', linkage: 'shared'