Compilation error with ifstream on Solaris v7/Sun Workshop 5.0

Compilation error with ifstream on Solaris v7/Sun Workshop 5.0

Post by NorthCoa » Thu, 29 Nov 2001 07:14:27



I am trying to compile code that passes an ifstream** to a method, by
taking the address of a local ifstream*.  When I attempt to compile
the code on Solaris v7 (running on an UltraSPARC machine), using Sun
Workshop v5.0, I get the following error:

Error: Formal argument theStream of type ifstream** in call to static
SocketImpl::createInputStream(int, ifstream**) is being passed
std::basic_ifstream<char, std::char_traits<char>>**.

If I turn on the -compat=4 switch, this code will compile properly.
However, other code in the same library requires that the switch not
be used.  Is there another switch that can be used to alleviate this
problem?

Thanks,
NorthCoast

 
 
 

Compilation error with ifstream on Solaris v7/Sun Workshop 5.0

Post by Fletcher Glen » Thu, 29 Nov 2001 08:50:35


Why are you trying to pass in an ifstream**?
Why not pass in an ifstream*?  All of this notwithstanding,
have you considered casting the ifstream** in
your method call?

--
Fletcher Glenn
to reply remove NOSPAM from my reply address


Quote:> I am trying to compile code that passes an ifstream** to a method, by
> taking the address of a local ifstream*.  When I attempt to compile
> the code on Solaris v7 (running on an UltraSPARC machine), using Sun
> Workshop v5.0, I get the following error:

> Error: Formal argument theStream of type ifstream** in call to static
> SocketImpl::createInputStream(int, ifstream**) is being passed
> std::basic_ifstream<char, std::char_traits<char>>**.

> If I turn on the -compat=4 switch, this code will compile properly.
> However, other code in the same library requires that the switch not
> be used.  Is there another switch that can be used to alleviate this
> problem?

> Thanks,
> NorthCoast


 
 
 

Compilation error with ifstream on Solaris v7/Sun Workshop 5.0

Post by NorthCoa » Fri, 30 Nov 2001 03:52:41


Sadly, this is not my code.  I am trying to port it using a new
compiler version (v5.0 of Sun Workshop).  My code requires the new
compiler, and this code compiles successfully under v4.2 of Sun
Workshop, as well as xlC for AIX, which is the original platform for
the code.  Also, there are a couple of instances where ifstream* and
ofstream* are being passed as params, and I receive the same error in
those cases, though obviously minus the extra *.  Futher, I am getting
(and have been getting) two error messages that the types ifstream and
ofstream are incomplete.

I tried casting the variables in the param calls, but that did not
solve the problem.  Thanks for the response, though.


> Why are you trying to pass in an ifstream**?
> Why not pass in an ifstream*?  All of this notwithstanding,
> have you considered casting the ifstream** in
> your method call?

> --
> Fletcher Glenn
> to reply remove NOSPAM from my reply address

 
 
 

Compilation error with ifstream on Solaris v7/Sun Workshop 5.0

Post by Kevin D. Cla » Fri, 30 Nov 2001 05:38:15



> Sadly, this is not my code.  I am trying to port it using a new
> compiler version (v5.0 of Sun Workshop).  My code requires the new
> compiler, and this code compiles successfully under v4.2 of Sun
> Workshop, as well as xlC for AIX, which is the original platform for
> the code.  Also, there are a couple of instances where ifstream* and
> ofstream* are being passed as params, and I receive the same error in
> those cases, though obviously minus the extra *.  Futher, I am getting
> (and have been getting) two error messages that the types ifstream and
> ofstream are incomplete.

> I tried casting the variables in the param calls, but that did not
> solve the problem.  Thanks for the response, though.

IIRC, I had a lot of problems with C++ stream sorts-of-things when I
installed that version of the compiler.  In fact, IIRC, I couldn't
even get a C++ "hello, world" program to compile until I installed
these patches.

(there were, ahem, "issues" having to do with Sun's shipping of both
the "classic" iostream library and the newer Standard Library version)

I would suggest that you check Sun's web site for these patches.

From my notes, here were the relevant patch IDs:

108434-01
107390-11
107357-09
107311-11
107289-05

(also, I believe that Sun has a newer version of this compiler available)

Hope this helps,

--kevin
--
Kevin D. Clark (cetaceannetworks.com!kclark)  |   Will hack Perl for
Cetacean Networks, Inc.                       |  fine food, good beer,
Portsmouth, N.H. (USA)                        |       or fun.
alumni.unh.edu!kdc (PGP Key Available)        |

 
 
 

1. Compilation Problem: solaris 5.7 and Sun Workshop 5.0

We are compiling a piece of code on Solaris 2.7 with Sun Workshop 5.0.
While linking if we give cout in the code it gives the following error
:

undefined symbol
std::basic_ostream<char,std::char_traits<char>

But if we declare a boolean variable and output it usnig cout before
any other cout call in the code it works fine .
i.e if I add

bool bTemp = true;
cout<<bTemp<<endl;

before the first call to cout then it works fine. We are calling some
third party libraries from this piece of code.
One similar problem comes when I use "ofstream" type of object in
other shared library, It compiles fine but fails when called from an
executable.
This whole thing is working fine on Solaris 2.8. I feel the problem is
due to some incompatible libraries.

Can anybody suggest any patch recommended, or solution to this
problem.

Regards
Deepesh

2. Turning Off echo

3. Need help to run SUN Workshop 5.0 beta (problems to run solaris license manager)

4. Disks under FreeBSD

5. Problems compiling glib (solaris 5.6, Sun Workshop C++ 5.0)

6. How can I account the printer ?

7. compatibility between GCC and sun workshop 5.0 on Solaris 7

8. fetchmail / pop: message not the expected length

9. gpc on Sun Solaris 8 with WorkShop 5.0

10. GNU PC on Sun Solaris 8 with WorkShop 5.0

11. Sun workshop 5.0 and rogue wave??

12. Sun Workshop 5.0 Developer Release licensing issue!

13. Sun Workshop 5.0, linking with libC and libCrun