Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ undefined reference when linking
    primarykey
    data
    text
    <p>Im wondering if anyone would be able to help me as I have been scratching my head for two days on this.</p> <p>I have done the compilation and when trying to link a source code on linux getting <em>undefined reference</em></p> <p>Compiling using,</p> <blockquote> <p>g++ -g -I/u01/kasunt/workspace/corelibCORBA/include -I/u01/kasunt/workspace/corelibCORBA/installed_components/include -I/u01/kasunt/workspace/corelibCORBA/idl -I/u01/kasunt/workspace/corelibCORBA/src/Server -I/u01/kasunt/workspace/corelibCORBA/installed_components/idl -I/u01/kasunt/workspace/corelibCORBA/installed_components/src/Server -I/u01/kasunt/workspace/corelibCORBA/installed_components/imake -DNARROWPROTO -I . -I/u01/kasunt/workspace/corelibCORBA/installed_components/include -W -Wall -Wpointer-arith -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -g -O -I/u01/kasunt/workspace/corelibCORBA/include -g -O -I/u01/kasunt/workspace/corelibCORBA/include -fvisibility=hidden -fvisibility-inlines-hidden -DACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS=1 -W -Wall -Wpointer-arith -ggdb -pipe -Wall -g -D__linux__ -D__x86__ -rdynamic -D_REENTRANT -DTAO_HAS_INTERCEPTORS=0 -DTAO_HAS_VALUETYPE=1 -D_REENTRANT -DACE_HAS_AIO_CALLS -D_GNU_SOURCE -I/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers -I/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers/TAO -I/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers/TAO/orbsvcs -DACE_HAS_EXCEPTIONS -D__ACE_INLINE__ -c -o TestSeqWrapper.o TestSeqWrapper.cpp</p> </blockquote> <p>Linking using,</p> <blockquote> <p>g++ -o TestSeqWrapper TestSeqWrapper.o -g -L/u01/kasunt/workspace/corelibCORBA/lib -L/u01/kasunt/workspace/corelibCORBA/installed_components/lib -g -O -Wl,-E -L/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers/lib -L/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers/lib -L/usr/local/ACE+TAO+CIAO-5.7.9/ACE_wrappers/TAO/tao -L/u01/kasunt/workspace/corelibCORBA/installed_components/idl -lcorelibCORBA -lcorelibCORBA /u01/kasunt/workspace/corelibCORBA/installed_components/lib/corelibCORBA3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/CorbaController3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/EConcurrency3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/corelibLogger3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/LeakTracker3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/trace3r.lib -lDefineTimeZone /u01/kasunt/workspace/corelibCORBA/installed_components/lib/timestamp3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/ApplConfig3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/appl3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/logstream3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/disklog3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/timeout3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/getpnam3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/config3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/strl3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/string3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/command3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/cmdargs3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/CppUtils3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/BuildTag3r.lib /u01/kasunt/workspace/corelibCORBA/installed_components/lib/exception3r.lib <strong>-lCorbaIdl</strong> -lTAO_Valuetype -lTAO_PortableServer -lTAO_IORTable -lTAO_AnyTypeCode -lTAO_CosEvent -lTAO_CosNaming -lTAO -lACE</p> </blockquote> <pre><code>TestSeqWrapper.o: In function `SeqWrapper': /u01/kasunt/workspace/corelibCORBA/include/corelibCORBA/SeqWrapper.hpp:165: undefined reference to `ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T()' </code></pre> <p>Doing nm of the library I can see the above constructor is included,</p> <pre><code>nm --demangle ../installed_components/lib/libCorbaIdl.so | grep "ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T" 000327ba t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(ECONZ::Corba::ComboElementSeq_T const&amp;) 000331c2 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(unsigned int) 0002edb0 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(unsigned int, unsigned int, ECONZ::Corba::ComboElement_T*, bool) 0002d768 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T() 00032e52 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(ECONZ::Corba::ComboElementSeq_T const&amp;) 0003172a t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(unsigned int) 0002d8e0 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T(unsigned int, unsigned int, ECONZ::Corba::ComboElement_T*, bool) 0002d8a6 t ECONZ::Corba::ComboElementSeq_T::ComboElementSeq_T() </code></pre> <p>Offending line on the source code (line 165), <strong>SeqWrapper() : var_( new SequenceType ), size_( 0 ) { }</strong></p> <p>Part of the code,</p> <pre><code>template&lt; typename SEQUENCE &gt; class SeqWrapper : CppUtils::NonCopy { public: typedef SEQUENCE SequenceType; typedef typename SequenceType::_var_type SequenceType_var; typedef typename ElementTypeOf&lt;SequenceType_var&gt;::ElementType ElementType; typedef typename ElementTypeOf&lt;SequenceType_var&gt;::ReturnType ReturnType; typedef typename ElementTypeOf&lt;SequenceType_var&gt;::ConstReturnType ConstReturnType; private: SequenceType_var var_; CORBA::ULong size_; void expand_( CORBA::ULong size ) { // NOTE: current implementation assumes size only increases by small increments if (size &gt; var_-&gt;length()) { var_-&gt;length( (size &lt; 16)? 16 : (size &gt; 256? size+256 : 2*size-2) ); } } public: SeqWrapper() : var_( new SequenceType ), size_( 0 ) { } SeqWrapper( CORBA::ULong reserve ) : var_( new SequenceType( reserve ) ), size_( 0 ) { var_-&gt;length( reserve ); } SeqWrapper( SequenceType *ownSeq ) : var_( ownSeq ), size_( ownSeq-&gt;length() ) { } ..... </code></pre> <p>Source code of TestSeqWrapper.cpp (I have removed most of the unwanted stuff to make it less confusing)</p> <pre><code>#include &lt;iostream&gt; #include &lt;CppUtils/StringHelpers.hpp&gt; #include &lt;corelibCORBA/SeqWrapper.hpp&gt; #include &lt;CorbaC.h&gt; using namespace std; int main() { ECONZ::Corba::SeqWrapper&lt; ECONZ::Corba::StringSeq_T &gt; seq; } </code></pre> <p>And you can see that I have specified the shared library in the link options (shown in bold). I initially thought it might be due a dependency of some sort and moved the library flag to the beginning to no affect.</p> <p>I appreciate it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload