Thread overview
Using std::string?
Oct 15, 2005
Kixdemp
Oct 15, 2005
Bertel Brander
Oct 15, 2005
sulfurik15
Oct 15, 2005
Kixdemp
Oct 15, 2005
Walter Bright
Oct 15, 2005
Kixdemp
October 15, 2005
Hello everyone! :-D
OK, here be my code:

-----------------
#include <stdlib.h>
#include <string.h>

int main()
{
string hello("Hellawz!!1");
}
-----------------

And here's my command line:

dmc -mtd -IC:\dm\stlport\stlport dost.cpp

This is what I get on compile:

-----------------
Z:\dost>dmc -mtd -IC:\dm\stlport\stlport dost.cpp
string hello("Hellawz!!1");
^
dost.cpp(6) : Error: undefined identifier 'string'
string hello("Hellawz!!1");
^
dost.cpp(6) : Warning 6: value of expression is not used
--- errorlevel 1

Z:\dost>
-----------------

I tried using std::string, using namespace std, nothing worked... anyone know how to fix it? Thanks! ;-)


October 15, 2005
Kixdemp wrote:
> #include <string.h>
> 
string.h is for C-string manipulation functions, such as
strcpy, strcmp, etc.

To get C++ stl string use string (note without the .h).
E.g:

#include <string>
using std::string;
int main()
{
   string hello("Hellawz!!1");
}

-- 
Absolutely not the best homepage on the net:
http://home20.inet.tele.dk/midgaard
But it's mine - Bertel
October 15, 2005
Now I get these errors:

------------------------
using _STLP_VENDOR_CSTD::fgetwc;
^
c:\dm\stlport\stlport\cwchar(199) : Error: undefined identifier 'fgetwc'
using _STLP_VENDOR_CSTD::fgetws;
^
c:\dm\stlport\stlport\cwchar(200) : Error: undefined identifier 'fgetws'
using _STLP_VENDOR_CSTD::fputwc;
^
c:\dm\stlport\stlport\cwchar(201) : Error: undefined identifier 'fputwc'
using _STLP_VENDOR_CSTD::fputws;
^
c:\dm\stlport\stlport\cwchar(202) : Error: undefined identifier 'fputws'
using _STLP_VENDOR_CSTD::fwprintf;
^
c:\dm\stlport\stlport\cwchar(210) : Error: undefined identifier 'fwprintf'
Fatal error: too many errors
--- errorlevel 1
------------------------

Do you know how I can fix them? Thanks very much! ;-)

In article <diqg87$1q4n$1@digitaldaemon.com>, Bertel Brander says...
>
>Kixdemp wrote:
>> #include <string.h>
>> 
>string.h is for C-string manipulation functions, such as strcpy, strcmp, etc.
>
>To get C++ stl string use string (note without the .h).
>E.g:
>
>#include <string>
>using std::string;
>int main()
>{
>    string hello("Hellawz!!1");
>}
>
>-- 
>Absolutely not the best homepage on the net:
>http://home20.inet.tele.dk/midgaard
>But it's mine - Bertel


October 15, 2005
Wait a minute... I don't get any of that if I remove the "-mtd" from the command line... I need this program to work on pure MS-DOS... do you know how to fix it? Thanks! ;-)


October 15, 2005
"Kixdemp" <Kixdemp_member@pathlink.com> wrote in message news:dirc31$2g9a$1@digitaldaemon.com...
> Wait a minute... I don't get any of that if I remove the "-mtd" from the
command
> line... I need this program to work on pure MS-DOS... do you know how to
fix it?

The STL doesn't work under MS-DOS. For one thing, it's a little too large to work with the 'tiny' (-mt) memory model, where code+data needs to fit in 64K. You'll need to stick with the functionality in the C headers.


October 15, 2005
In article <dirh1n$2k4d$1@digitaldaemon.com>, Walter Bright says...
>
>
>"Kixdemp" <Kixdemp_member@pathlink.com> wrote in message news:dirc31$2g9a$1@digitaldaemon.com...
>> Wait a minute... I don't get any of that if I remove the "-mtd" from the
>command
>> line... I need this program to work on pure MS-DOS... do you know how to
>fix it?
>
>The STL doesn't work under MS-DOS. For one thing, it's a little too large to work with the 'tiny' (-mt) memory model, where code+data needs to fit in 64K. You'll need to stick with the functionality in the C headers.
>
>

Blah, that stinks! :-(
Thanks though! ;-)