libstdc++.so.5 vs. libstdc++.so.6 and externa libraries

A

angels__tear

Hi -
I'm creating an application for a communications network that
needs to be portable between at least Mandrake Linux 10 and Solaris 9
(obviously, the more portable, the better). I realized shortly into the
development process that I was using gcc 3.3.2 on the linux machine,
and gcc 3.4.0 on my solaris machines. I upgraded gcc to 3.4 on the
linux machine, but now am having issues involving libstdc++.so.5 and
libstdc++.so.6

The first issue is that an external library (SocketW -
http://www.digitalfanatics.org/cal/socketw/ ) that I am using seems to
depend on libstdc++.so.5 specific features, and will not compile using
libstdc++.so.6. If I leave both shared objects linked to, then gcc
issues a warning everytime I make the application (this isn't too bad,
I can deal with warnings, if they don't actually cause an issue)

The second problem may or may not be related. I wrote the entire
program on the linux machine, compiled and ran it just fine. One of the
classes in the program uses the stl queue class. Again, this worked
fine on linux, but when I tried to compile on the solaris machines, I
get this error (it actually occurs twice, once for each queue I'm
declaring):

error: ISO C++ forbids declaration of `queue' with no type
error: expected `;' before '<' token

Any help would be greatly appriciated - I can, of course, put up more
information if it would be helpful in solving these issues.
Chris Phillips
 
V

Victor Bazarov

[...] I upgraded gcc to 3.4 on the
linux machine, but now am having issues involving libstdc++.so.5 and
libstdc++.so.6

This is beyond the scope of this newsgroup. We deal with the
language, not with a particular standard library implementations.
The first issue is that an external library [...]

Can't help you there, try a gnu.g++.help newsgroup or a newsgroup
for Linux or Solaris (or both).
The second problem may or may not be related. I wrote the entire
program on the linux machine, compiled and ran it just fine. One of the
classes in the program uses the stl queue class. Again, this worked
fine on linux, but when I tried to compile on the solaris machines, I
get this error (it actually occurs twice, once for each queue I'm
declaring):

error: ISO C++ forbids declaration of `queue' with no type
error: expected `;' before '<' token

For what code?
Any help would be greatly appriciated - I can, of course, put up more
information if it would be helpful in solving these issues.

FAQ 5.8.

Victor
 
M

Marc

The first issue is that an external library (SocketW -
http://www.digitalfanatics.org/cal/socketw/ ) that I am using seems to
depend on libstdc++.so.5 specific features, and will not compile using
libstdc++.so.6.

you mean gcc-3.(3|4), not libstdc++.so.(5|6)
it probably means that it is not standard c++, and that g++-3.3 was more
lenient than g++-3.4.
If I leave both shared objects linked to, then gcc
issues a warning everytime I make the application (this isn't too bad,
I can deal with warnings, if they don't actually cause an issue)

Never got a crash because of that here, but hey, you never know...
error: ISO C++ forbids declaration of `queue' with no type

Do you have these two lines in your file?
Any help would be greatly appriciated - I can, of course, put up more
information if it would be helpful in solving these issues.

As was said, a gcc newsgroup knows best about gcc...
 
C

Chris Phillips

The second problem may or may not be related. I wrote the entire
For what code?

Here's the declaration that will compile on the linux machine, but not
on the solaris machines:

queue<char *> myqueue;

Interestingly enough, when I made a test class and ran it, queue's
worked fine. Is there some other header (from the list below maybe?)
that is known not to work with queue. Also, other stl containers seem
to want to work fine, I've tried deque and priority_queue - but I'd
much prefer to stick with queue.

Here's the list of headers included:
#include <queue>
#include "messages.h"
#include "SocketW.h"
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <iostream>

Thanks!
 
V

Victor Bazarov

Chris said:
Here's the declaration that will compile on the linux machine, but not
on the solaris machines:

queue<char *> myqueue;

This declaration will not compile _by_itself_ because 'queue' has not
been defined.
Interestingly enough, when I made a test class and ran it, queue's
worked fine. Is there some other header (from the list below maybe?)
that is known not to work with queue. Also, other stl containers seem
to want to work fine, I've tried deque and priority_queue - but I'd
much prefer to stick with queue.

Here's the list of headers included:
#include <queue>
#include "messages.h"
#include "SocketW.h"
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <iostream>

The list above includes two standard headers (<queue> and <iostream>)
and a bunch of non-standard (probably compiler- and OS-specific) ones.
C++ makes no claims WRT other headers. Try the newsgroup for your
compiler and/or OS.

Could it be that you're missing the fact that all standard containers
are declared in the namespace 'std'? What compiler are you using on
Linux? Could it be gcc 2.95.x? That's too old. Update your compiler
and make your code up to snuff WRT the C++ language. You can find more
information on 'std' namespace in any C++ book released after 1998. I
recommend "Accelerated C++". Also, a book on Standard Library wouldn't
hurt. Try "The C++ Standard Library" by Josuttis. It's the best there
is.

Victor
 

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
474,039
Messages
2,570,376
Members
47,028
Latest member
IsmaelLans

Latest Threads

Top