Hello Community,
I am writing to see if you could help us with the following problem we have. After making a merge between an old version and a new one (our c++ code) that now uses EPICS 7 (7.0.6.2-DEV), we get a compilation error in the linking process, that is, the library compiles correctly but when we try to compile the examples we get the error "libgiapi-glue-cc. so: *undefined reference to `epics::pvDatabase::PVDatabase::addRecord*(std::shared_ptr<epics::pvDatabase::PVRecord> const&)'"".
Analysing the built library (libgiapi-glue-cc.so.0.16) to see the symbols defined, we have used the nm tool. We can see that the addRecord function requires the *std::shared::ptr parameter* (it must be defined in the libpvDatabase.so.4.6.1 library). The output of the nm command is copied below.
nm --format sysv libgiapi-glue-cc.so.0.16 | c++filt | grep addR
*epics::pvDatabase::PVDatabase::addRecord(std::shared_ptr<epics::pvDatabase::PVRecord>* const&)| | | U | NOTYPE| | |*UND*
Now, if we analyze the EPICS library *libpvDatabase.so.4.6.1*, we get that the "addRecord" function requires the parameter std::tr1::shared_ptr instead of std::shared_ptr. The output of the nm command is copied below.
*epics::pvDatabase::PVDatabase::addRecord(std::tr1::shared_ptr<epics::pvDatabase::PVRecord> const&)*| |000000000004c120| T | FUNC|0000000000000370| | |.text
If we analyze the source code, we can see that the PVImageRecordPtr type has been defined with std::tr1::shared_ptr. Below you can se the code extract or in the following link(https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.h <https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.h>, line 136 and 250)
/class PVImageRecord;
// typedef std::tr1::shared_ptr<PVImageRecord> PVImageRecordPtr;
// PVImageRecordPtr pvImageRecord;/
Next, the PVImageRecord class inherits from the epics::pvDatabase::PVRecord class, which defines the create method. Below is a small fragment of the code: (https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.cpp <https://github.com/framos-gemini/giapi-glue-cc/blob/peterMerge/src/data/PVImageAgent.cpp>).
/ class PVImageRecord: public epics::pvDatabase::PVRecord {
public:
POINTER_DEFINITIONS(PVImageRecord);
static PVImageRecordPtr create(std::string const & recordName, LoggerPtr lg)/
In the same PVImageAgent.cpp file, line 606, is where the record is introduced. As you can see, the *addRecord function is being called* with the *std::tr1::shared_ptr *type (PVImageRecordPtr pvImageRecord) instead of *std::shared_ptr.* Therefore, it is strange what is happening. Any suggestions?
Thank you in advance and also for the good responses that have allowed us to move forward.
Regards,