template problems

Dear Sirs:

I am working on a sun machine (SUNOS 5.6) and met template problems.

In the compiling phase, everything looks fine. I turned on

"verbose=template" and so I could see clearly every template instance

that I need is instantiated. However, when it comes to the "loading"

phase with "ild", it reports the error of "(undefined symbol)" for the

template instances. I saw these

instances are instantiated during the compiling phase and I also can

make it sure by using "CCadmin -info", but somehow the "ild" can't find

the template definations in the template database (./SunWS_cache/) to

resolve the references for the templates. I tried but couldn't figure it

out yet. The only other thing that I felt may be related is that I can't

find the directory .\SunWS_config\ . The only directory is ./SunWS_cache

and its numerous subdirectories. I am wondering what goes wrong.

Thank you very much. Please email me at yong@smartcad.me.wisc.edu

yong at yong@smartcad.me.wisc.edu

[1086 byte] By [luyong] at [2007-11-25 23:41:02]
# 1

/* Please look at the following simple program */

#include <iostream>

#include <fstream>

#include "netdb.h"

using namespace std;

int

main()

{

fstream s;

cout << "Hello World" << endl;

cout << __lock;

cout << __unlock;

struct servent* se;

se = getservbyname("control_test", "tcp");

}

/*

Compiling the above code with one of the following sequences of commands

# CC -c -g -mt main.cc ; CC -mt -lsocket main.o

or# CC -c -g -O0 -mt main.cc ; CC -xnolib -mt -lsocket main.o -lCstd -lCrun -lm -lw -lcx -lc -lthread

on a Solaris 7, gives me an executable which stale locks immediately

in the beginning of execution, when the fstream object is created.

I first observed this error in a more complex and really multithreaded

programm where the fstream object was created dynamically in one

subthread.

I'm short before deciding to drop using the fstream and work out

the project with the old stream interface. Please note that I'm using

ISO ANSI representation of streams in this code that means it

is a std::basic_fstream<char ... > which locks the __stream_mutex

inherited by ios_base. The executable breaks exactly at the

beginning of the basic_ios::init function as described in

/opt/SUNWspro/SC5.0/include/ios.cc

I hope that someone previously encountered and probably solved this

problem (not worked around please).

CU Axel

Aredder at 2007-7-5 18:48:45 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

Standard C++ Library and -compat=4

Hi,

Is it possible to use the standard template library provided with Workshop 5.0 while compiling with option -compat=4 ?

As I do not succeed in that way, I tried to use an external STL (SGI) but I encountered some problems with templates and the following error occurs :

"Error: The name [...] is unusable in [...]

Where: While instantiating [...]

Where: Instantiated from non-template code."

Thanks in advance for your help.

Regards.

Pascal Jussac (pjussac@icdc.caissedesdepots.fr)

pjussac at 2007-7-5 18:48:45 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

Hi

I am compiling and link code with gcc , and use the STL vector.

in the code I add #include <vector> . when I build the exe,

the compilation pass witout problems , and I fail on link .

the error that I get is "undefined symbol" .

If you know any option I need to add to compilation or link command,

or any other solution to solve the problam , I will be greatfull.

thank you any way

Gil.

gil_elbit at 2007-7-5 18:48:45 > top of Java-index,Development Tools,Solaris and Linux Development Tools...