www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Accelerated C++

↑ ↓ ← "jim p" <x y.com> writes:
I'm finally getting around to teaching myself C++ using DM.
The book I'm using is Accelerated C++.
I only started today, but the already the simple examples (said to be ANSI)
are not compiling.

For example:

    // a small C++ program
    #include <iostream>

    int main()
    {
         std::cout << "Hello, world!" << std::endl;
         return 0;
    }

This fails because it requires the #include to include the .h extension.
Changing this and recompiling gives the following messages:

tip.cpp:
        std::cout << "Hello, world!" << std::endl;
                ^
tip.cpp(6) : Error: 'cout' is not a member of namespace 'std'
        std::cout << "Hello, world!" << std::endl;
                                                 ^
tip.cpp(6) : Warning 6: value of expression is not used
tip.cpp(10) : Error: need at least one external def
--- errorlevel 1


OK, I know it works when std:: is removed, but why ??

Jim
Jul 02 2003
"Andrew Edwards" <edwardsac spamfreeusa.com> writes:
"jim p" <x y.com> wrote...
 OK, I know it works when std:: is removed, but why ??

using namespace std; It is not yet implemented; DM it is not yet fully ANSI compliant. Regards, Andrew
Jul 02 2003
↑ ↓ "jim p" <x y.com> writes:
So the -A switch for strict ANSI is of little use ?




"Andrew Edwards" <edwardsac spamfreeusa.com> wrote in message
news:bdu928$2ai6$1 digitaldaemon.com...
 "jim p" <x y.com> wrote...
 OK, I know it works when std:: is removed, but why ??

using namespace std; It is not yet implemented; DM it is not yet fully ANSI compliant. Regards, Andrew

Jul 02 2003
↑ ↓ → "Andrew Edwards" <edwardsac spamfreeusa.com> writes:
"jim p" <x y.com> wrote ...
 So the -A switch for strict ANSI is of little use ?

would say it's just not fully implemented as yet. // a small C++ program #include <iostream.h> // not the added extension .h using namespace std; // as stated by the ANSI standard int main() { cout << "Hello, world!" << endl; return 0; }
Jul 02 2003
"Wichetael" <wichetael gmx.net> writes:
This is because the way the SGI iostream library is set up, it is not fully
implemented yet and is still experimental. There are indeed two versions of
the iostreams library, one which is iostream.h, which simply defines
everything in the global namespace and iostream, which defines everything in
the std namespace. The SGI iostreams implementation does not yet include the
iostream header, which is why you get an error for your program. What you'd
want to do is use STLport instead, you can get it off the DM CD or download
the latest version from the DM site. Follow the installation instructions
and make sure you place the stlport path before the SGI stl path in the
SC.INI file. Try your initial program again and you should find that it
compiles and works beautifully.

Regards,
Remko van der Vossen


"jim p" <x y.com> wrote in message news:bdu7ib$294j$1 digitaldaemon.com...
 I'm finally getting around to teaching myself C++ using DM.
 The book I'm using is Accelerated C++.
 I only started today, but the already the simple examples (said to be

 are not compiling.

 For example:

     // a small C++ program
     #include <iostream>

     int main()
     {
          std::cout << "Hello, world!" << std::endl;
          return 0;
     }

 This fails because it requires the #include to include the .h extension.
 Changing this and recompiling gives the following messages:

 tip.cpp:
         std::cout << "Hello, world!" << std::endl;
                 ^
 tip.cpp(6) : Error: 'cout' is not a member of namespace 'std'
         std::cout << "Hello, world!" << std::endl;
                                                  ^
 tip.cpp(6) : Warning 6: value of expression is not used
 tip.cpp(10) : Error: need at least one external def
 --- errorlevel 1


 OK, I know it works when std:: is removed, but why ??

 Jim

Jul 02 2003
↑ ↓ "jim p" <x y.com> writes:
I've updated my CD releases until the latest one.
I've downloaded and installed the STLport files.
When I try to make the library I get the following

 make -fdm.mak clean all

Any ideas why this is happening ?? James "Wichetael" <wichetael gmx.net> wrote in message news:bdug0k$2h2u$1 digitaldaemon.com...
 This is because the way the SGI iostream library is set up, it is not

 implemented yet and is still experimental. There are indeed two versions

 the iostreams library, one which is iostream.h, which simply defines
 everything in the global namespace and iostream, which defines everything

 the std namespace. The SGI iostreams implementation does not yet include

 iostream header, which is why you get an error for your program. What

 want to do is use STLport instead, you can get it off the DM CD or

 the latest version from the DM site. Follow the installation instructions
 and make sure you place the stlport path before the SGI stl path in the
 SC.INI file. Try your initial program again and you should find that it
 compiles and works beautifully.

 Regards,
 Remko van der Vossen


 "jim p" <x y.com> wrote in message news:bdu7ib$294j$1 digitaldaemon.com...
 I'm finally getting around to teaching myself C++ using DM.
 The book I'm using is Accelerated C++.
 I only started today, but the already the simple examples (said to be

 are not compiling.

 For example:

     // a small C++ program
     #include <iostream>

     int main()
     {
          std::cout << "Hello, world!" << std::endl;
          return 0;
     }

 This fails because it requires the #include to include the .h extension.
 Changing this and recompiling gives the following messages:

 tip.cpp:
         std::cout << "Hello, world!" << std::endl;
                 ^
 tip.cpp(6) : Error: 'cout' is not a member of namespace 'std'
         std::cout << "Hello, world!" << std::endl;
                                                  ^
 tip.cpp(6) : Warning 6: value of expression is not used
 tip.cpp(10) : Error: need at least one external def
 --- errorlevel 1


 OK, I know it works when std:: is removed, but why ??

 Jim


Jul 02 2003
↑ ↓ "Walter" <walter digitalmars.com> writes:
"jim p" <x y.com> wrote in message news:bdv45r$5kk$1 digitaldaemon.com...
 I've updated my CD releases until the latest one.
 I've downloaded and installed the STLport files.
 When I try to make the library I get the following

 make -fdm.mak clean all

Any ideas why this is happening ??

To build the STLport libraries and dll's: cd \dm\stlport\src smake -f dm.mak which will build them into \dm\stlport\lib. To install them: xcopy \dm\stlport\lib\*.lib \dm\lib xcopy \dm\stlport\lib\*.dll \dm\bin Please check out \dm\stlport\readme.txt for more details.
Jul 02 2003
↑ ↓ → "jim p" <x y.com> writes:
Cheers Walter.
I found the readme.txt at the same time I got your reply.



"Walter" <walter digitalmars.com> wrote in message
news:bdv7pa$9es$2 digitaldaemon.com...
 "jim p" <x y.com> wrote in message news:bdv45r$5kk$1 digitaldaemon.com...
 I've updated my CD releases until the latest one.
 I've downloaded and installed the STLport files.
 When I try to make the library I get the following

 make -fdm.mak clean all

Any ideas why this is happening ??

To build the STLport libraries and dll's: cd \dm\stlport\src smake -f dm.mak which will build them into \dm\stlport\lib. To install them: xcopy \dm\stlport\lib\*.lib \dm\lib xcopy \dm\stlport\lib\*.dll \dm\bin Please check out \dm\stlport\readme.txt for more details.

Jul 02 2003
→ "Walter" <walter digitalmars.com> writes:
"jim p" <x y.com> wrote in message news:bdu7ib$294j$1 digitaldaemon.com...
 This fails because it requires the #include to include the .h extension.

<iostream> is in \dm\stlport\stlport. Try using the -I\dm\stlport\stlport switch.
Jul 02 2003