0

I have these 3 functions Which I converted it into templatized version to make it more generic.

#ifndef __CPPMARSH_H__
#define __CPPMARSH_H__


template<typename listT>
void cppListFromWire(void *&src,listT &dest, factorywv);
void cppListToWire(listT &src, void *&dest);
long cppListToWireSize(listT &list);

Defined in a different folder (not as in where I declared) as below,

template<typename listT>
void cppListToWire(listT &list, void *&dest)
{
        int nItems = (int) list.entries();
        cppIntToWire(&nItems, dest);
        //RWSlistIterator next(list);
        RWTValSlist<void *> next(list);
        while (next())
                ((AISObject*)next.key())->toWire(dest, 0);
}

But facing the below issue.Here RWTValSlist is a sourcePro library function,

Undefined                       first referenced
 symbol                             in file
void cppListToWire<RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> > >(RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> >&, void*&) /app/sdasup/home/mhp/source/develop/sd/lib/libsdHostSupport.so
long cppListToWireSize<RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> > >(RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> >&) /app/sdasup/home/mhp/source/develop/sd/lib/libsdHostSupport.so
void cppListFromWire<RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> > >(void*&, RWTValSlist<CSSCODERec*, std::allocator<CSSCODERec*> >&, AISObject* (*)()) /app/sdasup/home/mhp/source/develop/sd/lib/libsdHostSupport.so
ld: fatal: symbol referencing errors

These are the different methods I tried to resolve but in vain,

  1. Tried prototyping the function

  2. Tried including the flags under makefile ROGUEFLAGS=-lsdHostSupport ROGUELIBS=lsdHostSupport

  3. export LD_LIBRARY_PATH=/opt/RogueWave/SourcePro/2021/rw/ For this method though it clears the errors but throws the following eror,

3a. ld.so.1: buildserver: fatal: libtux.so.71: open failed: No such file or directory ----To mitigate this one I tried " ldd /opt/tuxedo/tuxedo12.2.2.0.0/lib/libtux.so.71" which didn't work.

Any help amounts to great appreciation.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Puneeth
  • 419
  • 1
  • 6
  • 18
  • Also note that with your declarations in the header file, only `cppListFromWire` is a template. The rest are plain non-template functions, attempting to use an unknown symbol `listT`. Which should lead to other errors before linking, so in the future please make sure to present a proper [mre] that replicates the error you ask about, and donät have other unrelated errors. – Some programmer dude Apr 20 '22 at 11:03
  • @Someprogrammerdude I have declared each one as separate template , template void cppListToWire(listT &src, void *&dest); template void cppListFromWire(void *&src,listT &dest, factorywv); template long cppListToWireSize(listT &list); – Puneeth Apr 20 '22 at 11:05
  • 1
    On another (and totally unrelated) note, all symbols beginning with two underscores are *reserved* and may not be defined or declared in your own code. See [What are the rules about using an underscore in a C++ identifier?](https://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier) – Some programmer dude Apr 20 '22 at 11:08
  • @Someprogrammerdude, please do provide the link which you have removed to give it a try. – Puneeth Apr 20 '22 at 12:24
  • Inline implementation of the template function in header file is not working though – Puneeth Apr 22 '22 at 14:19

0 Answers0