problem with templates using Sun Forte 7 compilers

C

ChrisG

Hi,
I am building an executable using Sun Forte 7 compilers. Because I
have both Fortran and
C++ source codes, I have to use f77 to do the final linking:

f77 -xarch=v9 -xildoff -o ../bin/rdc
*.o (... list of all the objects) \
-L. -L../bin/ -lsocket -lnsl -lintl -xarch=v9 -xildoff
-lpthread -lCrun -lCstd -lc

and I got tons of errors like:

Undefined first referenced
symbol in file
__1cMDynamicArray4Cb_2t6Mkb_v_ AlgebraicExprParser.o
__1cMDynamicArray4CpnENode__2T6M_v_ AlgebraicExprTree.o
__1cEList4CpnIPCEOrder__JdumpDeref6kMpkcrnDstdNbasic_ostream4Ccn0CLchar_traits4Cc____4_v_
UncertainInput.o
__1cEList4CpnSPermuteInstruction__2t6M_v_ SAXLoader.o
.......

All the undefined symbols are related to DynamicArray and List, which
are both templates.
Here is the DynamicArray code:

template <class T>
class DynamicArray {
private:
enum InitialSize { initDynArray = 1 };
public:
explicit DynamicArray (T const valDefault);
~DynamicArray ();
void setValue (int i, T const val);
...
private:
T * m_arr;
int m_capacity;
...;
};

template <class T>
DynamicArray <T>::DynamicArray (T const valDefault)
: m_capacity (initDynArray), m_highestAdd (0), m_valDefault
(valDefault) {
m_arr = new T [initDynArray]; // allocate memory
for (int i = 0; i < initDynArray; ++i)
m_arr = m_valDefault;
}

I have successful builds of the same project on all the other UNIX
platforms, including Linux,
HP, IRIX, AIX. I don't know what's going on with the Sun Forte build.
Any suggestions are
welcome.

Thanks in advance,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top