www.digitalmars.com         C & C++   DMDScript  

c++.stl - STL not present?

reply David <deimerl eimexinc.com> writes:
Dmc can't compile this program in the source file pmc.cpp.  How do
I access the stl?

#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void main(){
 string s="abs";  //dmc fails to compile this line
 cout<<s<<endl;
exit(0);
//end main
}
Jun 26 2009
parent reply Bertel Brander <bertel post4.tele.dk> writes:
David skrev:
 Dmc can't compile this program in the source file pmc.cpp.  How do
 I access the stl?
 
 #include <iostream.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 void main(){
  string s="abs";  //dmc fails to compile this line
  cout<<s<<endl;
 exit(0);
 //end main
 }

You have to include string (without .h), iostream has no .h eigther. And you need to tell the compiler to use the namespace std #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> using namespace std; int main() { string s="abs"; //dmc fails to compile this line cout<<s<<endl; exit(0); }
Jun 29 2009
parent David <deimerl eimexinc.com> writes:
Thank you. I had tried many variations of '.h' and 'using'
statements, but none of them worked until I changed the sc.ini
file to include the stlport files as first item in both INCLUDE
and LIB keywords. Walter Bright has been very helpful to me in
getting this sorted out.
Jul 01 2009