[PLUG] Problem with C++ and shared libraries.

Arindam arindam.mukerjee at gmail.com
Fri Jun 29 12:07:18 IST 2007


On 6/29/07, Ritesh Khadgaray <khadgaray at gmail.com> wrote:
> On Wed, 2007-06-27 at 15:26 +0530, amol bhor wrote:
> > Hi all,
> >
> > I am Amol. I want to implement the shared libraries with C++. I
> > googled for it and found the way to implement shared libraries.
> >
> > The problem that I am facing is that the _string_ class which is used
> > in C++ for the string operations is not working with shared libraries.
> > It gives error as
> >
> > 'string' does not name a type .
> >
> > Same error I'm getting for iftream & ofstream which are required for
> > the file operations.
> >
> > Do I need to speify any library while compiling the the code with
> > -fPIC option to g++ compiler?
> > Or do I need to add anything extra?
>
> On newer version you would need to import std namespace, or explicitly
> specify the namespace
>
> 1.
> using namespace std;
> string str;
>

> 2.
> using std::string;
> string str;
^^^
This one is almost always the preferred form of usage.
1. brings in everything into the global namespace.
3. is too cumbersome to write, and worse to read.

>
> 3.
> std::string str;
>
> >
> > Kindly help out.
> >
> > Thanks & regards
> > Amol Bhor.
> >
> > --
> > ______________________________________________________________________
> > Pune GNU/Linux Users Group Mailing List:      (plug-mail at plug.org.in)
> > List Information:  http://plug.org.in/cgi-bin/mailman/listinfo/plug-mail
> > Send 'help' to plug-mail-request at plug.org.in for mailing instructions.
> --
> Ritesh Khadgaray
> ॐ मणि पद्मे हूँ
> LinuX N Stuff
> Ph: +919970164885
> Eat Right, Exercise, Die Anyway.
>
>
> --
> ______________________________________________________________________
> Pune GNU/Linux Users Group Mailing List:      (plug-mail at plug.org.in)
> List Information:  http://plug.org.in/cgi-bin/mailman/listinfo/plug-mail
> Send 'help' to plug-mail-request at plug.org.in for mailing instructions.
>


-- 
Against stupidity, the Gods themselves contend in vain -- Friedrich Schiller


More information about the Plug-mail mailing list